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.4
  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. var img=document.createElement('img');
  25. img.src='https://ptpimg.me/2rwc77.png';
  26. img.style.height='0.8em';
  27. a.appendChild(img);
  28. span.appendChild(document.createTextNode(' '));
  29. span.appendChild(a);
  30. var a=document.createElement('a');
  31. a.href="https://passtheheadphones.me/torrents.php?searchstr="+encodeURIComponent(artist+' '+album);
  32. //a.innerHTML = "pth";
  33. var img=document.createElement('img');
  34. img.src='https://ptpimg.me/2rwc77.png';
  35. img.style.height='0.8em';
  36. a.appendChild(img);
  37. pTitle.appendChild(a);
  38. }
  39. })();