TKU iClass Downloader

Download Tronclass Courseware

当前为 2021-01-14 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name TKU iClass Downloader
  3. // @namespace TKU.iClass
  4. // @version 2.3.4-TKU
  5. // @license MIT
  6. // @description Download Tronclass Courseware
  7. // @author Hs0 (Forked from NCJ)
  8. // @match *://iclass.tku.edu.tw/course/*/courseware
  9. // @grant none
  10. // @require https://cdn.bootcss.com/jquery/3.5.0/jquery.min.js
  11. // ==/UserScript==
  12. $(document).bind('DOMSubtreeModified', function() {
  13. if ($('#Tronclass_Downloader').length == 0 && $('#file-previewer-with-note > div > div > div.header.clearfix').length) {
  14. $('#file-previewer-with-note > div > div > div.header.clearfix').append('<input type="button" value="下載" id="Tronclass_Downloader">');
  15. $("#Tronclass_Downloader").css("position", "relative").css("left", 10);
  16. $('#Tronclass_Downloader').click(function(){
  17. window.open(decodeURIComponent(document.getElementById('pdf-viewer').src.split("?file=")[1]));
  18. });
  19. }
  20.  
  21. if ($('#Tronclass_Downloader_video').length == 0 && $('video').length && $('video')[0].children.length == 3 && $('video')[0].children[0].getAttribute('src').indexOf('/api') == 0) {
  22. var v=$('video')[0];
  23. for (var i of v.children) {
  24. $(v.parentNode.parentNode).prepend(`<a href="${i.getAttribute('src')}" id="Tronclass_Downloader_video">\t${i.getAttribute('label')}\t</a>`);
  25. }
  26. }
  27. });