chaoxing downloader

a small tool

  1. // ==UserScript==
  2. // @name chaoxing downloader
  3. // @namespace cekavis
  4. // @version 0.1
  5. // @description a small tool
  6. // @author Cekavis
  7. // @match *.chaoxing.com/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=chaoxing.com
  9. // @grant none
  10. // @license MIT
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // Your code here...
  17. window.onload = function(){
  18. var ppts = document.getElementsByTagName('iframe');
  19. console.log(ppts);
  20. for(var ppt of ppts){
  21. if(ppt.hasAttribute('data')){
  22. console.log(JSON.parse(ppt.getAttribute('data')).objectid);
  23. var a = document.createElement('a');
  24. a.target = "_blank";
  25. a.href = "https://cs-ans.chaoxing.com/download/" + JSON.parse(ppt.getAttribute('data')).objectid;
  26. a.innerHTML = "点击下载";
  27. ppt.parentNode.appendChild(a);
  28. }
  29. }
  30. }
  31. })();