PSO2 Weapon Library tool

Keep track of what weapons you have in your weapon library

当前为 2015-09-29 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name PSO2 Weapon Library tool
  3. // @namespace http://your.homepage/
  4. // @version 0.1
  5. // @description Keep track of what weapons you have in your weapon library
  6. // @author nixx quality
  7. // @match http://pso2.swiki.jp/index.php?%E3%82%BD%E3%83%BC%E3%83%89
  8. // @match http://pso2.swiki.jp/index.php?%E3%83%AF%E3%82%A4%E3%83%A4%E3%83%BC%E3%83%89%E3%83%A9%E3%83%B3%E3%82%B9
  9. // @match http://pso2.swiki.jp/index.php?%E3%83%91%E3%83%AB%E3%83%81%E3%82%B6%E3%83%B3
  10. // @match http://pso2.swiki.jp/index.php?%E3%83%84%E3%82%A4%E3%83%B3%E3%83%80%E3%82%AC%E3%83%BC
  11. // @match http://pso2.swiki.jp/index.php?%E3%83%80%E3%83%96%E3%83%AB%E3%82%BB%E3%82%A4%E3%83%90%E3%83%BC
  12. // @match http://pso2.swiki.jp/index.php?%E3%83%8A%E3%83%83%E3%82%AF%E3%83%AB
  13. // @match http://pso2.swiki.jp/index.php?%E3%82%AC%E3%83%B3%E3%82%B9%E3%83%A9%E3%83%83%E3%82%B7%E3%83%A5
  14. // @match http://pso2.swiki.jp/index.php?%E3%82%AB%E3%82%BF%E3%83%8A
  15. // @match http://pso2.swiki.jp/index.php?%E3%83%87%E3%83%A5%E3%82%A2%E3%83%AB%E3%83%96%E3%83%AC%E3%83%BC%E3%83%89
  16. // @match http://pso2.swiki.jp/index.php?%E3%82%A2%E3%82%B5%E3%83%AB%E3%83%88%E3%83%A9%E3%82%A4%E3%83%95%E3%83%AB
  17. // @match http://pso2.swiki.jp/index.php?%E3%83%A9%E3%83%B3%E3%83%81%E3%83%A3%E3%83%BC
  18. // @match http://pso2.swiki.jp/index.php?%E3%83%84%E3%82%A4%E3%83%B3%E3%83%9E%E3%82%B7%E3%83%B3%E3%82%AC%E3%83%B3
  19. // @match http://pso2.swiki.jp/index.php?%E3%83%90%E3%83%AC%E3%83%83%E3%83%88%E3%83%9C%E3%82%A6
  20. // @match http://pso2.swiki.jp/index.php?%E3%83%AD%E3%83%83%E3%83%89
  21. // @match http://pso2.swiki.jp/index.php?%E3%82%BF%E3%83%AA%E3%82%B9
  22. // @match http://pso2.swiki.jp/index.php?%E3%82%B8%E3%82%A7%E3%83%83%E3%83%88%E3%83%96%E3%83%BC%E3%83%84
  23. // @grant none
  24. // ==/UserScript==
  25.  
  26. // setting - セッテー
  27. var translate = true; // not implemented
  28.  
  29. /////////////////////////////////////
  30.  
  31. var tabl = document.getElementById("list").nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.childNodes[0];
  32. var thead = tabl.childNodes[0].childNodes[0];
  33. var tbody = tabl.childNodes[2];
  34.  
  35. var headeritem = document.createElement("th");
  36. headeritem.className = "style_th header";
  37. headeritem.innerText = "Library";
  38.  
  39. function checkboxclicked()
  40. {
  41. this.parentElement.style.backgroundColor = this.checked ? "green" : "red";
  42. localStorage[this.parentElement.parentElement.dataset.name] = this.checked;
  43. }
  44.  
  45. for (i = 0; i < tbody.childElementCount; i++)
  46. {
  47. itemname = tbody.childNodes[i].childNodes[2].firstChild.innerText;
  48. tbody.childNodes[i].dataset.name = itemname;
  49. checkboxtd = document.createElement("td");
  50. checkboxtd.style.textAlign = "center";
  51. checkbox = document.createElement("input");
  52. checkbox.type = "checkbox";
  53. checkbox.style.width = "30px";
  54. checkbox.style.height = "30px";
  55. if (tbody.childNodes[i].childNodes[0].style.backgroundColor != "rgb(255, 204, 153)") // ignore extended weapon listing
  56. {
  57. checkboxtd.style.backgroundColor = "red";
  58. checkboxtd.appendChild(checkbox);
  59. }
  60. if (localStorage[itemname] == "true")
  61. {
  62. checkboxtd.style.backgroundColor = "green";
  63. checkbox.checked = true;
  64. }
  65. checkbox.addEventListener("change", checkboxclicked);
  66. tbody.childNodes[i].insertBefore(checkboxtd, tbody.childNodes[i].firstChild);
  67. }