NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name Nayatel Total Internet Usage History // @namespace http://webit.pk/ // @version 0.1 // @description This user script adds a Total Row in Nayatel's customer area's Internet Usage History table. // @author Fahad Yousaf Mahar // @match https://customer.nayatel.com/CustomerPortalWeb/dashboard.php // @license GPL-3.0-or-later; http://www.gnu.org/licenses/gpl-3.0.txt // ==/UserScript== (function () { 'use strict'; $('#internetUsageHistory').click(function (e) { calculateTotalUsage(); }); $('#internet_submit_btn').click(function (e) { setTimeout(calculateTotalUsage, 2000); }); $('#view_btn').click(function (e) { setTimeout(calculateTotalUsage, 2000); }); })(); function calculateTotalUsage() { var uploads = 0; $('#internetUsageTable > tbody > tr').each(function (t) { var value = $(this).find('td:eq(1)').html(); uploads += parseFloat((!isNaN(value)) ? value : 0); }); var downloads = 0; $('#internetUsageTable > tbody > tr').each(function (t) { var value = $(this).find('td:eq(2)').html(); downloads += parseFloat((!isNaN(value)) ? value : 0); }); var totals = 0; $('#internetUsageTable > tbody > tr').each(function (t) { var value = $(this).find('td:eq(3)').html(); totals += parseFloat((!isNaN(value)) ? value : 0); }); $('#internetUsageTable').find('tbody').append('<tr><td>Totals</td><td>' + uploads.toFixed(2) + '</td><td>' + downloads.toFixed(2) + '</td><td>' + totals.toFixed(2) + '</td></tr>'); }