Nico manga download

Just do it

  1. // ==UserScript==
  2. // @name Nico manga download
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0
  5. // @description Just do it
  6. // @author Tinyblack / Youwang Translation Group
  7. // @match https://seiga.nicovideo.jp/watch/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. //创建按钮对象
  13. var downloadicon = document.createElement("button");
  14. downloadicon.style.cssText = 'position:fixed; right:1% ; top:20%; width: 180px; height: 60px;font-size: 16px;cursor: pointer;font-weight: 400;border: 0 solid;background-color: white;outline: 1px solid;transition: box-shadow 0.5s, outline-offset 0.3s, outline 0.3s, border-color 0.3s;';
  15. downloadicon.innerHTML = "下载所有图片";
  16. //控制下载方法
  17. downloadicon.onclick = function downloadimg(){
  18. let file = 1;
  19. let tcanvaslist = document.getElementsByTagName("canvas");
  20. let canvaslist = [];
  21. let indexlist = [];
  22. let min = 0;
  23. for (let i = 0 ; i < tcanvaslist.length ;) //按元素位于页面上下气泡排序
  24. {
  25. for(let j = 0 ; j < tcanvaslist.length ; j++)
  26. {
  27. if(tcanvaslist[j].getBoundingClientRect().y < tcanvaslist[min].getBoundingClientRect().y)
  28. {
  29. if(indexlist.includes(j) != true)
  30. {
  31. min = j;
  32. }
  33. }
  34.  
  35. }
  36. canvaslist.push(tcanvaslist[min]);
  37. indexlist.push(min);
  38. i++;
  39. min = i;
  40. }
  41. console.log("canvaslist:"+canvaslist);
  42. console.log("indexlist:"+indexlist);
  43. for (let i = 0 ; i < canvaslist.length ; i++){ //下载
  44. if(canvaslist[i].className != "balloon canvas")
  45. {
  46. let link = document.createElement("a");
  47. link.href = canvaslist[i].toDataURL();
  48. let filetype = ".jpg";
  49. if(canvaslist[i].toDataURL().match("data:image/png;") != null)
  50. {
  51. filetype = ".png";
  52. }
  53. if(canvaslist[i].toDataURL().match("data:image/jpg;") || canvaslist[i].toDataURL().match("data:image/jpeg;") != null)
  54. {
  55. filetype = ".jpg";
  56. }
  57. link.download = file + filetype;
  58. link.click();
  59. file ++;
  60. }
  61. }
  62. };
  63. document.body.appendChild(downloadicon); //添加下载按钮至网页
  64. })();

QingJ © 2025

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