Last active
December 7, 2023 15:07
-
-
Save aoirint/02b6d9c2b7335800ef6daa8535c5c650 to your computer and use it in GitHub Desktop.
ニコニコポイント通帳をTSV出力するUserScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name niconico_point_book_user_script | |
// @namespace Violentmonkey Scripts | |
// @match https://point.nicovideo.jp/index/bank/ | |
// @grant none | |
// @version 0.1.0 | |
// @author aoirint | |
// @description 2023-12-07T23:37:39+09:00 | |
// ==/UserScript== | |
(() => { | |
const textAreaElement = document.createElement("textarea") | |
textAreaElement.cols = 80 | |
textAreaElement.rows = 10 | |
textAreaElement.style.fontSize = "6pt" | |
textAreaElement.style.position = "fixed" | |
textAreaElement.style.zIndex = 999 | |
textAreaElement.style.left = 0 | |
textAreaElement.style.bottom = 0 | |
document.body.appendChild(textAreaElement) | |
textAreaElement.addEventListener("click", (event) => { | |
event.target.select() | |
}) | |
textAreaElement.value = [...document.querySelectorAll(".passbook-item")].map( | |
(item) => [ | |
new Date(item.querySelector("dd.date").innerText.trim()).toISOString(), | |
item.querySelector("dd.purchase_id").innerText.trim(), | |
item.querySelector("dd.service").innerText.trim(), | |
new String( | |
parseInt( | |
item.querySelector(".passbook-item-point").innerText.trim() | |
.replace("+", "+") | |
.replace("−", "-") | |
.replace(",", "") | |
), | |
), | |
].join("\t"), | |
).reverse().join("\n") | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment