AH price calc

Calculates the total price of your AH delivery and shows it on the "mijn lijst" page

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         AH price calc
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Calculates the total price of your AH delivery and shows it on the "mijn lijst" page
// @author       Maarten
// @match        https://www.ah.nl/mijnlijst
// @grant        none
// ==/UserScript==

setTimeout(calc, 2500)

function calc() {
    var total = 0;

    var item = document.querySelectorAll('.shoppinglist-lane article');
    for (var i = 0; item[i]; i++) {
        var price = 0;

        if (typeof item[i].childNodes[0].childNodes[3].childNodes[1] !== 'undefined') {
            price = item[i].childNodes[0].childNodes[3].childNodes[1].outerText;
        } else {
            price = item[i].childNodes[0].childNodes[3].outerText;
        }

        var quantity = item[i].childNodes[1].childNodes[1].childNodes[2].value;

        total += quantity * price; 
    }

    total = Math.round(total * 100) / 100;

    var header = document.querySelectorAll('.edc-heading.heading--10')[0];
    header.innerHTML = header.innerHTML + ' € '+total.toLocaleString();
}