chaoxing-download

try to take over the world!

目前为 2020-06-07 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name chaoxing-download
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description try to take over the world!
  6. // @author NL
  7. // @match https://mooc1-1.chaoxing.com/mycourse/studentstudy?*
  8. // @grant none
  9. // ==/UserScript==
  10. function setDl(){
  11. var iframes = document.getElementById("iframe").contentWindow.document.querySelectorAll("iframe")
  12. for(let i=0;i<iframes.length;i++){
  13. if(iframes[i].getAttribute("objectId")==null){
  14. continue
  15. }
  16. var url = "http://d0.ananas.chaoxing.com/download/"+iframes[i].getAttribute("objectId")
  17. var a = document.createElement('a');
  18. a.setAttribute('href', url);
  19. a.setAttribute('class','downloadable-content')
  20. var textnode=document.createTextNode("↓下载课件")
  21. a.appendChild(textnode)
  22. if(iframes[i].parentElement.getElementsByClassName('downloadable-content').length==0){
  23.  
  24. iframes[i].parentNode.insertBefore(a,iframes[i])
  25. console.log("inserted"+i)
  26. } else {//console.log('inserted already')
  27. //console.log(iframes[i].parentElement.getElementsByClassName('downloadable-content'))
  28. }
  29. }
  30. }
  31. (function() {
  32. 'use strict';
  33. var old_text = "";
  34. console.log("downloader script running:");
  35. setTimeout(function (){
  36. old_text = document.getElementsByTagName("h1")[0].innerHTML;
  37. document.getElementsByTagName("h1")[0].innerHTML += "--->Waiting";
  38. },500);
  39. setTimeout(function(){
  40. var parent_node = document.getElementsByClassName("goback")[0]
  41. var bt = document.createElement("button")
  42. bt.innerHTML = "刷新下载"
  43. bt.onclick = function(){setDl()}
  44. parent_node.appendChild(bt)
  45. },500);
  46. setTimeout(function(){
  47. document.getElementsByTagName("h1")[0].innerHTML = old_text
  48. setDl()
  49. },1500);
  50. // Your code here...
  51. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址