// ==UserScript== // @name 国家开放大学全网办学平台(国开实验学院)/新国开一网一全自动模拟播放视频 // @namespace 一心向善 // @license MIT // @version 0.1.0 // @description 国家开放大学全网办学平台(国开实验学院)相关视频自动学习自动看视频程序,问题可反馈群:756253160 // @author Ink // @concat
天天向上
\",\"uploads\":[],\"category_id\":${id}}`; topic_header.method = 'POST'; let body = { org_id: globalData.course.orgId, user_id: globalData.user.id, course_id: globalData.course.id, enrollment_role: 'student', is_teacher: false, activity_id: id, activity_type: 'forum', activity_name: null, module: null, action: 'create_topic', ts: new Date().getTime(), user_agent: window.navigator.userAgent, mode: 'normal', channel: 'web', target_info: {}, master_course_id: $('#masterCourseId').val(), topic_name: '好好学习', org_name: globalData.user.orgName, org_code: globalData.user.orgCode, user_no: globalData.user.userNo, user_name: globalData.user.name, course_code: globalData.course.courseCode, course_name: globalData.course.name, dep_id: globalData.dept.id, dep_name: globalData.dept.name, dep_code: globalData.dept.code, }; statisticsReq(body); PostTopics(topic_header); //undefinedCategory(id,header1) forumScore( activity_id, globalData.user.id, header1 ); resolve(true); } else { showMsg( item.title + ' 已发过贴则不再发', 'info', 'top-end', 1000 ); resolve(true); } }); }); } else { showMsg('该课程没有讨论区。已跳过'); resolve(true); } } }); } else { showMsg('没有找到讨论区。\n请联系qq群号756253160', 'error'); resolve(true); } } }) .then(() => { if (videos_not_complete.length == 0) { showMsg(`刷完了`, 'success'); astrict(); new Promise((resolve, reject) => { if (GetGMBody() == 1) { setTimeout(() => { window.location.reload(); }, 2000); } }); } }) }); }, 3500); /* 解决:文字复制 */ } else if (/learning-activity\/full-screen\#/.test(href)) { let flag; let Inter = setInterval(() => { $('div.simditor-body.needsclick').each((index, item) => { for (let attr in item) { if (/jQuery(\d+)/.test(attr)) { if (item[attr].events.paste !== null) { item[attr].events.paste = null; } else { flag = 1; } } } }); }, 500); if (flag == 1) { clearInterval(Inter); } showMsg(`文本框可复制粘贴`, 'success'); } }; // 学习进度 function GetLearnProcess(id, header) { header.body = null; header.method = 'GET'; header.accept = 'application/json, text/plain, */*'; header.referrer = window.location.origin + window.location.pathname; return fetch(`https://lms.ouchn.cn/api/course/${id}/my-completeness`, header); } function astrict() { let body = GM_getValue('InkBody'); let href = window.location.origin + window.location.pathname; if (body == null || body == undefined) { if (body instanceof Array && isRepeat(body)) { GM_deleteValue('InkBody'); } body = [ { href: href, data: { nowdate: GetDate(), count: 1, }, }, ]; GM_setValue('InkBody', body); } else { let index = body.findIndex(item => { if (item.href == href) { return true; } }); if (index == -1) { body.push({ href: href, data: { nowdate: GetDate(), count: 1, }, }); GM_setValue('InkBody', body); } else { body[index].data.nowdate = GetDate(); body[index].data.count += 1; GM_setValue('InkBody', body); } } } function isRepeat(arr) { var hash = {}; for (var i in arr) { if (hash[arr[i]]) { return true; } hash[arr[i]] = true; } return false; } function GetDate() { return moment().format('YYYY/MM/DD'); } function GetGMBody() { let href = window.location.origin + window.location.pathname; console.log(GM_getValue('InkBody')); let InkBody = GM_getValue('InkBody'); if (InkBody == undefined || InkBody == null) { return 1; } else { let r = InkBody.filter(item => { if (item.href == href && item.data.count == 1 && item.data.nowdate == GetDate()) { return true; } }); if (r.length > 0) { return 1; } else { return 0; } } } function GetBrower() { let userAgent = navigator.userAgent; if (userAgent.indexOf('Chrome') > -1) { return 'Chrome'; } else if (userAgent.indexOf('Firefox') > -1) { return 'Firefox'; } return 'Chrome'; } // 获取发帖 function GetTopics(categoryid, header) { return fetch( `https://lms.ouchn.cn/api/forum/categories/${categoryid}?conditions=%7B%22topic_sort_by%22:%7B%22predicate%22:%22lastUpdatedDate%22,%22reverse%22:true%7D%7D&fields=id,title,created_by(id,name,nickname,comment),group_id,created_at,updated_at,content,read_replies(reply_id),reply_count,unread_reply_count,like_count,current_user_read,current_user_liked,in_common_category,user_role,has_matched_replies,uploads&page=1&pageSize=50`, header ).then(res => res.json()); } function forumScore(activityid, studentid, header) { return fetch( `https://lms.ouchn.cn/api/activities/${activityid}/students/${studentid}/forum-score`, header ); } // 发帖 function PostTopics(header) { fetch('https://lms.ouchn.cn/api/topics', header); } // 获取讨论区分类 function GetTopicCategories(category_id, header) { return fetch( `https://lms.ouchn.cn/api/courses/${category_id}/topic-categories?conditions=%7B%22itemsSortBy%22:%7B%22predicate%22:%22created_at%22,%22reverse%22:true%7D%7D&exclude_topic_list=true&include_subtasks=false&page=1&page_size=50`, header ).then(res => res.json()); } /* 在线视频 */ function OnlineVideo(header, body) { header.method = 'POST'; header.body = JSON.stringify(body); header.referrer = 'https://lms.ouchn.cn/course/18068/learning-activity/full-screen'; return fetch('https://lms.ouchn.cn/statistics/api/online-videos', header); } /* 用户访问统计 */ function UserVisits(header, body) { header.referrer = 'https://lms.ouchn.cn/course/18068/ng'; header.body = JSON.stringify(body); header.method = 'POST'; return fetch('https://lms.ouchn.cn/statistics/api/user-visits', header); } /* 当前视频进度-video */ function ActivitiesRead(video_id, header) { return fetch(`https://lms.ouchn.cn/api/course/activities-read/${video_id}`, header); } /* get请求,应该没用 */ function undefinedReq(id) { return fetch(`https://lms.ouchn.cn/api/activities/${id}`, { headers: { accept: 'application/json, text/plain, */*', 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8', 'cache-control': 'no-cache', pragma: 'no-cache', 'sec-ch-ua': '"Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Windows"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', }, referrer: 'https://lms.ouchn.cn/course/10000003894/learning-activity/full-screen', body: null, method: 'GET', mode: 'cors', credentials: 'include', }); } function LearnProcessReq(id) { return fetch(`https://lms.ouchn.cn/api/course/activities-read/${id}`, { headers: { accept: '*/*', 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8', 'cache-control': 'no-cache', 'content-type': 'application/json', pragma: 'no-cache', 'sec-ch-ua': '"Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Windows"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'x-requested-with': 'XMLHttpRequest', }, referrer: 'https://lms.ouchn.cn/course/10000003894/learning-activity/full-screen', body: '{}', method: 'POST', mode: 'cors', credentials: 'include', }); } // 学习行为分析 function statisticsReq(body) { return fetch('https://lms.ouchn.cn/statistics/api/learning-activity', { headers: { accept: 'application/json, text/javascript, */*; q=0.01', 'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8', 'cache-control': 'no-cache', 'content-type': 'application/json; charset=UTF-8', pragma: 'no-cache', 'sec-ch-ua': '"Chromium";v="104", " Not A;Brand";v="99", "Google Chrome";v="104"', 'sec-ch-ua-mobile': '?0', 'sec-ch-ua-platform': '"Windows"', 'sec-fetch-dest': 'empty', 'sec-fetch-mode': 'cors', 'sec-fetch-site': 'same-origin', 'x-requested-with': 'XMLHttpRequest', }, referrer: 'https://lms.ouchn.cn/course/10000003894/learning-activity/full-screen', body: JSON.stringify(body), method: 'POST', mode: 'cors', credentials: 'include', }); } function ImportJs(src) { let script = document.createElement('script'); script.setAttribute('type', 'text/javascript'); script.src = src; document.documentElement.appendChild(script); } function showMsg(title, type = 'success', position = 'top', timer = 2000) { Swal.fire({ toast: true, position: position, type: type, title: title, showConfirmButton: false, timer: timer, }); } })();