From 36d3eae87dbed96cfe1b8f74ffb510a98351eb4a Mon Sep 17 00:00:00 2001 From: Jan Bader Date: Sat, 14 May 2016 14:24:55 +0200 Subject: [PATCH] Remember values in data attributes --- total-cost.handyflash.user.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/total-cost.handyflash.user.js b/total-cost.handyflash.user.js index 3dea60a..21769f6 100644 --- a/total-cost.handyflash.user.js +++ b/total-cost.handyflash.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Gesamtkosten Handyflash // @namespace http://tampermonkey.net/ -// @version 0.3 +// @version 0.4 // @description Berechnet die Gesamtkosten der Verträge auf handyflash.de // @author Jan Bader // @match http*://www.handyflash.de/handys/* @@ -17,14 +17,20 @@ function actionFunction() { jQuery("article.rate").each( function(i, tarif) { + if(jQuery(tarif).data("gesamt") !== "undefined") + return; + var grundgebuehr_text = jQuery(tarif).find(".tariff_price").text(); var grundgebuehr = parseFloat(grundgebuehr_text.split("€")[0].replace(',', '.')); grundgebuehr = Math.round(grundgebuehr, 2); + jQuery(tarif).data("monatlich", grundgebuehr); var anzahlung_text = jQuery(tarif).find(".tariff_payout").text(); var anzahlung = parseFloat(anzahlung_text.split("€")[0].replace(',', '.')); anzahlung = Math.round(anzahlung, 2); + jQuery(tarif).data("geraet", anzahlung); var gesamt = grundgebuehr * 24 + anzahlung; + jQuery(tarif).data("gesamt", gesamt); var details = jQuery(tarif).find(".tariff_links"); var header = jQuery(tarif).find(".tarife_box_header").text().replace(/^\s+|\s+$/g, '');