Copy All Link Imagas

try

目前为 2024-01-26 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Copy All Link Imagas
  3. // @namespace http://yu.net/
  4. // @version 2024-01-23
  5. // @description try
  6. // @author Yu
  7. // @match https://bunkr.sk/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=monotaro.id
  9. // @require https://update.greasyfork.org/scripts/485684/1317487/Downloader%20JS%20File.js
  10. // @grant GM_download
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. function createDownloadElement() {
  15. const button = document.createElement("button")
  16. button.style.background = "#ffd369";
  17. button.style.color = "#272727"
  18. button.style.fontWeight = "bold";
  19. button.classList.add("block", "mx-auto", "py-2", "px-4", "rounded");
  20. button.innerText = "Copy All Link";
  21.  
  22. return button
  23. }
  24.  
  25. function handleDownloadAllImages() {
  26. const elements = document.querySelectorAll(".grid-images_box a");
  27. const images = []
  28. elements.forEach(item => images.push(`https://i-taquito.bunkr.ru/${item.href.replace("https://bunkr.sk/i/", "")}`))
  29. if("navigator" in window) {
  30. navigator.clipboard.writeText(images.join("\n")).then(() => window.alert("Link Copied")).catch((err) => alert("error"))
  31. } else {
  32. alert("Browser not supported");
  33. }
  34. }
  35.  
  36. function removeAllIframe() {
  37. const all = document.querySelector("iframe");
  38. if(all) return;
  39. for(const element of all) {
  40. element.remove()
  41. }
  42. }
  43.  
  44. (function() {
  45. 'use strict';
  46.  
  47. const button = createDownloadElement();
  48. button.onclick = handleDownloadAllImages;
  49.  
  50. document.querySelector("section").append(button);
  51. removeAllIframe();
  52. setInterval(() => removeAllIframe(), 1000);
  53. })();