Copy all Artstation Image links to Download

Add a button to copy all image links at Artstation page to bulk download.

当前为 2023-06-01 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Copy all Artstation Image links to Download
  3. // @namespace Violentmonkey Scripts
  4. // @version 1.0.2
  5. // @description Add a button to copy all image links at Artstation page to bulk download.
  6. // @author Wizzergod
  7. // @match https://*.artstation.*/*/*
  8. // @grant GM_setClipboard
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function copyLinksToClipboard() {
  16. var links = Array.from(document.querySelectorAll('a[download]')).map(link => link.href);
  17. var linksText = links.join('\n');
  18. navigator.clipboard.writeText(linksText)
  19. .then(() => {
  20. alert('Links copied to clipboard!');
  21. })
  22. .catch(error => {
  23. console.error('Error copying links to clipboard:', error);
  24. });
  25. }
  26.  
  27. var copyButton = document.createElement('button');
  28. copyButton.innerText = 'Copy Links';
  29. copyButton.className = 'bs-btn bs-btn-primary';
  30. copyButton.style.cssText = `
  31. padding: 10px 20px 10px 16px;
  32. border-radius: 8px;
  33. display: flex;
  34. flex-direction: row;
  35. font-weight: 500;
  36. gap: 8px;
  37. justify-content: flex-start;
  38. line-height: 100%;
  39. color: black; /* Set the text color to black */
  40. `;
  41.  
  42. var targetElement = document.querySelector('ul.menu-level-1-buttons.sm-gap-medium');
  43. var listItem = document.createElement('li');
  44. listItem.style.listStyle = 'none'; // Remove the dot style
  45. listItem.appendChild(copyButton);
  46. targetElement.appendChild(listItem);
  47.  
  48. copyButton.addEventListener('click', copyLinksToClipboard);
  49. })();