PSO2 Weapon Library tool

Keep track of what weapons you have in your weapon library

目前為 2015-09-29 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         PSO2 Weapon Library tool
// @namespace    https://greasyfork.org/en/users/3372-nixxquality
// @version      0.3
// @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
                 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.getElementsByTagName("table")[1];
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.text;
    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);
}