san3Xian / randomMark

用github repo做一些随记好了,内容在issues里。github page中仅为试验田🧪
https://qc47.net
4 stars 0 forks source link

Tampermonkey+腾讯课堂+超过有效期的活动课程 #20

Open san3Xian opened 4 years ago

san3Xian commented 4 years ago
// ==UserScript==
// @name         腾讯课堂-过时课程入口显现
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  腾讯课堂-过期课程播放按钮
// @author       WILO
// @supportURL   https://github.com/easyjack/randomMark/issues/20
// @match        https://ke.qq.com/course/*
// @icon         https://ke.qq.com/favicon.ico
// @grant        none
// @run-at       document-end
// ==/UserScript==

//var term_id = document.getElementsByClassName("class-content js-term-item js-term-baseinfo class-content--no-des active")[0].getAttribute("data-termid");
var cource_id = metaData.terms[0].cid;
var term_id = metaData.terms[0].term_id;

if(document.getElementById("js-imgtext")){
    var button_bar= document.getElementById("js-imgtext").getElementsByClassName("text-right text-right--pay")[0].getElementsByClassName("oper-bar")[0];
    console.log(button_bar);
    var button_player=document.createElement("span");
    button_player.setAttribute("class","btn-join btn-default");
    //button_player.setAttribute("onclick","window.location.href='/webcourse/index.html#cid=" + cource_id + "&term_id=" + term_id + "'");
    button_player.setAttribute("onclick","window.open('https://ke.qq.com/webcourse/index.html#cid=" + cource_id + "&term_id=" + term_id + "')");

    button_player.textContent="进入播放页";

    button_bar.appendChild(button_player);
}
san3Xian commented 4 years ago

screenshot: image