Greasy Fork 还支持 简体中文。

MyAnimeList(MAL) - Com-to-Com Links

Add Com-to-Com link between user and comment user for every comment.

目前為 2015-10-25 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name MyAnimeList(MAL) - Com-to-Com Links
  3. // @version 1.1.1
  4. // @description Add Com-to-Com link between user and comment user for every comment.
  5. // @author Cpt_mathix & N_Ox
  6. // @include http://myanimelist.net/profile*
  7. // @include http://myanimelist.net/comments*
  8. // @exclude http://myanimelist.net/profile/*/reviews
  9. // @exclude http://myanimelist.net/profile/*/recommendations
  10. // @exclude http://myanimelist.net/profile/*/clubs
  11. // @exclude http://myanimelist.net/profile/*/friends
  12. // @grant none
  13. // @namespace https://greasyfork.org/users/16080
  14. // ==/UserScript==
  15.  
  16. if (document.location.href.indexOf('profile') > -1) {
  17. var element = document.getElementById('lastcomment').getElementsByTagName('a');
  18. for(var i = 0; i < element.length; i++) {
  19. if (element[i].innerHTML.indexOf("All Comments") > -1) {
  20. comtocom(element[i].href);
  21. break;
  22. }
  23. }
  24. } else
  25. comtocom(document.location.href);
  26.  
  27. function comtocom(url) {
  28. if (typeof jQuery == 'undefined') $ = unsafeWindow.$;
  29.  
  30. var i = url.indexOf('id=');
  31. if (i == -1) return;
  32. url = 'http://myanimelist.net/comtocom.php?id1=' + url.substr(i + 3) + '&id2=';
  33.  
  34. if (document.location.href.indexOf('profile') == -1) {
  35. $('div[id^=comBox] > table > tbody > tr').each(function () {
  36. var avatar = $('.picSurround img', this);
  37. if (!avatar.length) return;
  38.  
  39. var com = $('div[id^=com]:not([id^=comtext])', this);
  40. if (!com.length) return;
  41. if (com.children().length == 3) return;
  42.  
  43. var id = avatar.attr('src');
  44. var i = id.indexOf('thumbs/');
  45. if (i == -1) return;
  46. id = id.substr(i + 7, id.indexOf('_') - i - 7);
  47.  
  48. com.append(
  49. $('<div style="margin-top:10px" align="right"/>').append(
  50. $('<a title="Comment-to-Comment">Conversation</a>').attr('href', url + id)));
  51. });
  52. } else {
  53. $('div[id^=comBox]').each(function () {
  54. if (this.getElementsByClassName('postActions ar mt4').length != 0)
  55. return;
  56. var avatar = $('img', this);
  57. if (!avatar.length) return;
  58. var id = avatar.attr('src');
  59. var i = id.indexOf('userimages/');
  60. if (i == -1) return;
  61. id = id.substr(i + 11, id.indexOf('.jpg') - i - 11);
  62. var div = document.createElement('div');
  63. div.className = 'postActions ar mt4 mr12';
  64. var link = document.createElement('a');
  65. link.href = url + id;
  66. link.innerHTML = "Conversation";
  67. div.appendChild(link);
  68. this.appendChild(div);
  69. });
  70. }
  71. }