PTH search link on discogs

Link to a search from discogs pages to PTH

当前为 2016-12-18 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name PTH search link on discogs
  3. // @version 0.3
  4. // @description Link to a search from discogs pages to PTH
  5. // @author Chameleon
  6. // @include http*://*discogs.com/*
  7. // @grant none
  8. // @namespace https://greasyfork.org/users/87476
  9. // ==/UserScript==
  10.  
  11. (function() {
  12. 'use strict';
  13.  
  14. var pTitle=document.getElementById('profile_title');
  15. if(pTitle)
  16. {
  17. var album = pTitle.getElementsByTagName('span');
  18. album=album[album.length-1].textContent.trim();
  19. var span=pTitle.getElementsByTagName('a')[0].parentNode;
  20. var artist=span.getAttribute('title').replace(/\(.*\)/g, '');
  21. var a=document.createElement('a');
  22. a.href="https://passtheheadphones.me/artist.php?artistname="+artist;
  23. a.innerHTML = "pth";
  24. span.appendChild(document.createTextNode(' ('));
  25. span.appendChild(a);
  26. span.appendChild(document.createTextNode(')'));
  27. var a=document.createElement('a');
  28. a.href="https://passtheheadphones.me/torrents.php?searchstr="+encodeURIComponent(artist+' '+album);
  29. a.innerHTML = "pth";
  30. pTitle.appendChild(document.createTextNode(' ('));
  31. pTitle.appendChild(a);
  32. pTitle.appendChild(document.createTextNode(')'));
  33. }
  34. })();