Greasy Fork

Greasy Fork is available in English.

广东省国家工作人员学法考试系统刷课xfks-study

广东省国家工作人员学法考试系统刷课

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         广东省国家工作人员学法考试系统刷课xfks-study
// @namespace    http://greasyfork.icu/
// @version      1.03
// @description  广东省国家工作人员学法考试系统刷课
// @author       Cosil.C
// @match        http*://xfks-study.gdsf.gov.cn/study/*
// @icon         http://xfks-study.gdsf.gov.cn/study/static/images/favicon.ico?v2019031285
// @license      GPLv3
// ==/UserScript==

let pathname = window.location.pathname;

//首页
if (pathname.includes('index')) {
  //进入专题
  let nextCourseBtn = document.querySelector('.film_focus_imgs_wrap li .card.current div a.btn');
  if(nextCourseBtn){
    nextCourseBtn.click();
  }
} else if (pathname.includes('chapter')) {
  //文章页
  setInterval(() => {
    if (document.querySelector('.chapter-score').classList.contains('chapter-score-suc')) {
      let nextChapterBtn = document.querySelector('.next_chapter');
      //跳转下一篇文章
      if (nextChapterBtn) {
        console.log('准备跳转下一篇');
        nextChapterBtn.click();
      } else {
        //跳回目录
        console.log('准备返回目录');
        let navBackBtn = document.querySelector('.container.title.nav button');
        if(navBackBtn){
          navBackBtn.click();
        }
      }
    } else {
      submitLearn();
    }
  }, 1000);
} else if (pathname.includes('course')) {
  //专题页
  let targets = [].slice.call(document.querySelectorAll('.chapter li')).filter(v =>
    //判断文章是否未读
    v.querySelector('.sub_title')?.innerText.trim() === "" && v.querySelector('.title a')?.href
  )
  if (targets.length == 0) {
    console.log('该专题学习完毕,准备返回首页')
    window.location.pathname = 'study/index'
  } else {
    //进入文章
    console.log('准备进入文章' + targets[0].querySelector('.title a').innerText)
    targets[0].querySelector('.title a').click()
  }
}