BvS Lookup Linkifier

Inserts village lookup link on ninja lookup page.

  1. // ==UserScript==
  2. // @name BvS Lookup Linkifier
  3. // @namespace BvS
  4. // @version 1.2
  5. // @history 1.2 New domain - animecubedgaming.com - Channel28
  6. // @history 1.1 Now https compatible (Updated by Channel28)
  7. // @include http*://*animecubed.com/billy/bvs/*
  8. // @include http*://*animecubedgaming.com/billy/bvs/*
  9. // @description Inserts village lookup link on ninja lookup page.
  10. // @grant none
  11. // ==/UserScript==
  12.  
  13. var reVillage = /^(\w[\w\d\s]+) Village$/;
  14.  
  15. function ecansolLink(name)
  16. {
  17. var link = document.createElement("a");
  18. link.href = "http://bvs.ecansol.com/?page=panalyservillage&village=" + escape(name);
  19. link.setAttribute("style", "font-weight: bold; color: inherit;");
  20. link.textContent = name + " Village";
  21. return link;
  22. }
  23.  
  24. function vlookupLink(name)
  25. {
  26. var link = document.createElement("a");
  27. link.href = "vlookup.html?village=" + escape(name);
  28. link.textContent = name + " Village";
  29. return link;
  30. }
  31.  
  32. function villageNameNonKaiju()
  33. {
  34. var textSnap = document.evaluate("//table/tbody/tr/td/text()", document, null,
  35. XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  36. var txtnode;
  37. for (var i = 0; txtnode = textSnap.snapshotItem(i); i++)
  38. if (reVillage.test(txtnode.textContent))
  39. return {name: RegExp.lastParen, node: txtnode, kaiju: false};
  40. return null;
  41. }
  42.  
  43. function villageNameKaiju()
  44. {
  45. var textSnap = document.evaluate("//table/tbody/tr/td/center/i/i/b/text()", document, null,
  46. XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  47. var txtnode;
  48. for (var i = 0; txtnode = textSnap.snapshotItem(i); i++)
  49. if (reVillage.test(txtnode.textContent))
  50. return {name: RegExp.lastParen, node: txtnode, kaiju: true};
  51. return null;
  52. }
  53.  
  54. if (/bvs.lookup\b/.test(location.href)) {
  55. var village = villageNameNonKaiju() || villageNameKaiju();
  56. if (!village)
  57. return;
  58.  
  59. var link = vlookupLink(village.name);
  60. if (village.kaiju)
  61. link.setAttribute("style", "color: white");
  62. else
  63. link.setAttribute("style", "color: black");
  64. village.node.parentNode.replaceChild(link, village.node);
  65.  
  66. var link2 = ecansolLink(village.name);
  67. link2.textContent = "[?]";
  68. if (link.nextSibling)
  69. link.parentNode.insertBefore(link2, link.nextSibling);
  70. else
  71. link.parentNode.appendChild(link2);
  72. } else if (/bvs.vlookup\b/.test(location.href) || /bvs.village\b/.test(location.href)) {
  73. var nodes = document.evaluate("//table//td//b", document, null,
  74. XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  75.  
  76. for (var i = 0; i < nodes.snapshotLength; i++) {
  77. var node = nodes.snapshotItem(i);
  78. var txt = node.textContent;
  79. if (reVillage.test(txt)) {
  80. var name = RegExp.lastParen;
  81. var link = ecansolLink(name);
  82. node.parentNode.replaceChild(link, node);
  83. break;
  84. }
  85. }
  86. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址