Add total-cost.sparhandy
This commit is contained in:
parent
c90e1ca247
commit
ddd2b9d6f2
32
total-cost.sparhandy.user.js
Normal file
32
total-cost.sparhandy.user.js
Normal file
@ -0,0 +1,32 @@
|
||||
// ==UserScript==
|
||||
// @name Sparhandy tatsächliche Kosten
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 0.2
|
||||
// @description Berechnet die Gesamtkosten der Verträge auf sparhandy.de
|
||||
// @author Jan Bader <jan@javil.eu>
|
||||
// @match http://www.sparhandy.de/*
|
||||
// @updateUrl https://git.javil.eu/jacob1123/userscripts/raw/master/total-cost.sparhandy.user.js
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
jQuery(".tarife_box").each(
|
||||
function(i, tarif) {
|
||||
var details = jQuery(tarif).find(".tarifbox_details");
|
||||
var grundgebuehr_text = jQuery(details).find("li").first().text();
|
||||
var grundgebuehr = parseFloat(grundgebuehr_text.split("€")[1].replace(',', '.'));
|
||||
grundgebuehr = Math.round(grundgebuehr, 2);
|
||||
|
||||
var detailslink = jQuery(tarif).find(".detailslink").text();
|
||||
var anzahlung = parseFloat(detailslink.split("Ab")[1].replace(',', '.'));
|
||||
anzahlung = Math.round(anzahlung, 2);
|
||||
var gesamt = grundgebuehr * 24 + anzahlung;
|
||||
|
||||
var header = jQuery(tarif).find(".tarife_box_header").text().replace(/^\s+|\s+$/g, '');
|
||||
var info = (grundgebuehr * 24) + " + " + anzahlung + " = " + gesamt;
|
||||
details.append("<li>"+info+"</li>");
|
||||
console.log(header + ": " + info);
|
||||
}
|
||||
);
|
||||
})();
|
Loading…
x
Reference in New Issue
Block a user