TotalPayment

直近39件の支払いの合計金額を表示

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         TotalPayment
// @namespace    http://tampermonkey.net/
// @version      0.1.12
// @description  直近39件の支払いの合計金額を表示
// @author       c2tr
// @match        https://play.google.com/store/account/orderhistory*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=play.google.com
// @license MIT
// ==/UserScript==

var $ = window.jQuery;

function calc() {
    let total = 0;
    let count = document.querySelector("body > c-wiz > div > div > div:nth-child(4) > div").childElementCount;

    for (let i = 1; i < count; i++) {
        let icon = document.querySelector("body > c-wiz > div > div > div:nth-child(4) > div > div:nth-child(" + i + ") > div > img").getAttribute('src');
        let result
        //if (icon === "https://play-lh.googleusercontent.com/7c4jV4_Kt0O7zADgYwIoKNUCArxOfp8xPgIbIntY1ZfK6jNquYQsLwDg5wBlXYW9bA=s50-rw"){
            let value = document.querySelector("body > c-wiz > div > div > div:nth-child(4) > div > div:nth-child(" + i + ") > div:nth-child(2) > div > div:nth-child(2)").textContent.substring(1).replace(/,/g, '') - 0;
            result = i + " true : " + value + "円";
            total = total + value;
        /*} else {
            result = i + " false"
        }*/
        console.log(result);
        //document.querySelector("body > c-wiz > div > div > div:nth-child(4) > div > div:nth-child(" + i + ") > div:nth-child(2) > div > div > div:nth-child(2)").innerText = i;
      }

    document.querySelector("body > c-wiz > div > div > c-wiz > div > div > div > div").textContent = "直近39件の合計費用: ¥" + total

    console.log("合計課金額: ¥" + total);
}

(function() {
    let css = `
.float-button__wrap {
    width: 80px;
    height: 45px;
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 10;
}
.float-button__wrap a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    text-decoration: none;
    background-color: #0069b3 ;
    color: #fff;
}`;
    let style = document.createElement('style');
    style.innerHTML = css;
    document.head.append(style);

    let button = document.createElement('button');
    button.innerText = "Calculate!";
    button.onclick = function() { calc(); };
    button.classList.add("float-button__wrap");
    document.querySelector("body").appendChild(button);
    console.log("placed button!");
})();