PSO2 Weapon Library tool

Keep track of what weapons you have in your weapon library

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         PSO2 Weapon Library tool
// @namespace    http://your.homepage/
// @version      0.1
// @description  Keep track of what weapons you have in your weapon library
// @author       nixx quality
// @match        http://pso2.swiki.jp/index.php?%E3%82%BD%E3%83%BC%E3%83%89
// @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
// @match        http://pso2.swiki.jp/index.php?%E3%83%91%E3%83%AB%E3%83%81%E3%82%B6%E3%83%B3
// @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
// @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
// @match        http://pso2.swiki.jp/index.php?%E3%83%8A%E3%83%83%E3%82%AF%E3%83%AB
// @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
// @match        http://pso2.swiki.jp/index.php?%E3%82%AB%E3%82%BF%E3%83%8A
// @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
// @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
// @match        http://pso2.swiki.jp/index.php?%E3%83%A9%E3%83%B3%E3%83%81%E3%83%A3%E3%83%BC
// @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
// @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
// @match        http://pso2.swiki.jp/index.php?%E3%83%AD%E3%83%83%E3%83%89
// @match        http://pso2.swiki.jp/index.php?%E3%82%BF%E3%83%AA%E3%82%B9
// @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
// @grant        none
// ==/UserScript==

// setting - セッテー
var translate = true; // not implemented

/////////////////////////////////////

var tabl = document.getElementById("list").nextElementSibling.nextElementSibling.nextElementSibling.nextElementSibling.childNodes[0];
var thead = tabl.childNodes[0].childNodes[0];
var tbody = tabl.childNodes[2];

var headeritem = document.createElement("th");
headeritem.className = "style_th header";
headeritem.innerText = "Library";

function checkboxclicked()
{
    this.parentElement.style.backgroundColor = this.checked ? "green" : "red";
    localStorage[this.parentElement.parentElement.dataset.name] = this.checked;
}

for (i = 0; i < tbody.childElementCount; i++)
{
    itemname = tbody.childNodes[i].childNodes[2].firstChild.innerText;
    tbody.childNodes[i].dataset.name = itemname;
                           
    checkboxtd = document.createElement("td");
    checkboxtd.style.textAlign = "center";
    checkbox = document.createElement("input");
    checkbox.type = "checkbox";
    checkbox.style.width = "30px";
    checkbox.style.height = "30px";
    
    if (tbody.childNodes[i].childNodes[0].style.backgroundColor != "rgb(255, 204, 153)") // ignore extended weapon listing
    {
        checkboxtd.style.backgroundColor = "red";
        checkboxtd.appendChild(checkbox);
    }
    
    if (localStorage[itemname] == "true")
    {
        checkboxtd.style.backgroundColor = "green";
        checkbox.checked = true;
    }
    
    checkbox.addEventListener("change", checkboxclicked);
    
    tbody.childNodes[i].insertBefore(checkboxtd, tbody.childNodes[i].firstChild);
}