Skip to content

Instantly share code, notes, and snippets.

@jimmiw
Created January 14, 2011 10:17
Show Gist options
  • Select an option

  • Save jimmiw/779444 to your computer and use it in GitHub Desktop.

Select an option

Save jimmiw/779444 to your computer and use it in GitHub Desktop.
På bibob's site, under forbrug, så kan man se en oversigt og pris for ens data forbrug, MEN ikke hvor meget man har brugt i den periode. Her er et lille script der kan fyres af, for at få det i listen også
/**
* Gå ind på mit bibob, vælg "Mit forbrug", skriv din periode, åben firebug,
* og brug konsollen og kopier følgende kode stump ind. Så kan du se hvor
* meget data du har brugt for den valgte periode.
*/
var total = 0;
$('#table_0 table .usageCell5subsub nobr').each(function() {
total += Number($(this).text().split(' ')[0]);
})
// tests if the usage should be displayed in MB or KB
if(total>1024) {
total = (total/1024).toFixed(2) + ' MB';
}
else {
total = total.toFixed(2) + ' KB';
}
// finds the cell to display the data in
var cell = $('#usageTable .usageItemTr:first .usageCell4');
// gets the current text
var cellText = $(cell).text();
// inserts the "usage" text in the price cell.
$(cell).text(cellText + ' forbrug: '+total);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment