Copy Magnets

Copy magnet links to clipboard

As of 2016-03-05. See the latest version.

  1. // ==UserScript==
  2. // @name Copy Magnets
  3. // @namespace http://rix.li/
  4. // @version 0.2
  5. // @description Copy magnet links to clipboard
  6. // @author rix
  7. // @match *://www.tokyotosho.info/*
  8. // @require http://code.jquery.com/jquery-latest.js
  9. // @grant GM_setClipboard
  10. // @grant GM_log
  11. // ==/UserScript==
  12.  
  13. var list = $('a[href^=magnet]');
  14. var links = [];
  15.  
  16. list.each(function(){
  17. links.push(this.href);
  18. });
  19.  
  20. list.click(function(e) {
  21. e.preventDefault();
  22. GM_setClipboard(this.href, 'text');
  23. });
  24.  
  25. $('<div style="text-align: center; margin: 20px;"></div>').append(
  26. $('<button>Copy All</button>').click(function(){
  27. GM_setClipboard(links.join('\n'));
  28. })
  29. ).insertBefore('.listing');