doubanmail

用于将豆瓣中的“私信”修改为“豆邮”

  1. // ==UserScript==
  2. // @name doubanmail
  3. // @description 用于将豆瓣中的“私信”修改为“豆邮”
  4. // @version 1.01
  5. // @namespace Capella
  6. // @grant GM_getValue
  7. // @grant GM_setValue
  8. // @grant GM_xmlhttpRequest
  9. // @grant GM_log
  10. // @grant GM_getResourceURL
  11. // @include http://*douban.com*
  12. // @require https://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js
  13. // ==/UserScript==
  14. t = $('title');
  15. t[0].innerHTML = t[0].innerHTML.replace(/ 私信/g,"我的豆邮");
  16. t[0].innerHTML = t[0].innerHTML.replace(/私信/g,"豆邮");
  17.  
  18.  
  19. t = document.getElementById("top-nav-doumail-link");
  20. t.innerHTML = t.innerHTML.replace(/私信/g,"豆邮");
  21.  
  22. if(location.pathname.indexOf("people")!=-1){
  23. t = document.evaluate(
  24. "//a[@class='a-btn mr5']",
  25. document,
  26. null,
  27. XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
  28. null);
  29. if(t.snapshotLength>0){
  30. t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/私信/g,"豆邮");
  31. }
  32. }
  33. if(location.pathname.indexOf("doumail")!=-1){
  34. t = document.getElementsByTagName("h1");
  35. for(var i=0;i<t.length;i++){
  36. if(t[i].innerHTML.indexOf("不影响功能使用")!=-1){
  37. t[i].innerHTML = "我的豆邮";
  38. }
  39. }
  40. t = document.getElementsByTagName("h1");
  41. for(var i=0;i<t.length;i++){
  42. t[i].innerHTML = t[i].innerHTML.replace(/私信/g,"豆邮");
  43. }
  44. t = document.evaluate(
  45. "//a[@class='label']",
  46. document,
  47. null,
  48. XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
  49. null);
  50. if(t.snapshotLength>0)t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/私信/g,"豆邮");
  51. t = document.evaluate(
  52. "//div[@class='inbox-filter-list']",
  53. document,
  54. null,
  55. XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
  56. null);
  57. if(t.snapshotLength>0)t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/私信/g,"豆邮");
  58. t = document.evaluate(
  59. "//div[@class='tabs']",
  60. document,
  61. null,
  62. XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
  63. null);
  64. if(t.snapshotLength>0)t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/私信/g,"豆邮");
  65. t = document.evaluate(
  66. "//div[@class='aside']",
  67. document,
  68. null,
  69. XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
  70. null);
  71. //alert(t.snapshotLength);
  72. if(t.snapshotLength>0){
  73. t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/返回私信/g,"返回我的豆邮");
  74. t.snapshotItem(0).innerHTML = t.snapshotItem(0).innerHTML.replace(/私信/g,"豆邮");
  75. }
  76. t = document.evaluate(
  77. "//div[@class='item-submit']",
  78. document,
  79. null,
  80. XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
  81. null);
  82. if(t.snapshotLength>0){
  83. if(t.snapshotItem(0).innerHTML.indexOf("回应")!=-1){
  84. t.snapshotItem(0).innerHTML = '<span class="bn-flat"><input type="submit" name="m_reply" value="回信"></span>';
  85. }
  86. }
  87. }
  88.  
  89. t = document.getElementsByTagName("script");
  90. for(var i=0;i<t.length;i++){
  91. if(t[i].innerHTML.indexOf("私信")!=-1){
  92. t[i].innerHTML = t[i].innerHTML.replace(/私信/g,"豆邮");
  93. }
  94. }