Greasy Fork

Greasy Fork is available in English.

51CTO打印课程目录

51CTO打印课程目录与内容详情

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         51CTO打印课程目录
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  51CTO打印课程目录与内容详情
// @author       小明
// @match        https://edu.51cto.com/course/*
// @icon         https://edu.51cto.com/favicon.ico
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

//打印函数
function pp(){
	var str = '' + '\n';
	var fstr = '本节课,老师要讲解如下这些内容:';
	var arr = document.querySelectorAll('.mylesson-title a');
	for (let x of arr){
		let a = x.parentNode.previousElementSibling.innerText;
		let b = x.innerText;
		str += '\n\n\n' + '## ' + a + b + '\n';

		if(x.nextElementSibling){
			//console.info(x.nextElementSibling.children[0].innerText)
			let c = x.nextElementSibling.children[0].innerText;
			c = c.replaceAll(fstr,'');
			str += c;
		}

	}
	console.info(str);
}


	//展开课程目录
    setTimeout(function(){
		document.querySelector('#lessonFile .icon-down').click();

    },3000)

	//调用打印函数
	 setTimeout(function(){
        pp();
    },5000)

})();