Created
May 27, 2015 13:15
-
-
Save AdamEsterle/9b60ae2204412133de04 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var data = {}; | |
var dollars = {}; | |
jQuery.get( "https://www.att.com/olam/billUsageTiles.myworld", function( mbData ) { | |
var names = []; | |
jQuery('a.font14.linkColor.float-left').each(function(i) { | |
var name = jQuery(this).text().trim(); | |
names.push(name.substring(0, name.length - 12).trim()); | |
}); | |
jQuery(mbData).find('a[title="Web Usage"]').each(function(i) { | |
data[names[i]] = parseFloat(jQuery(this).find('span > strong').text().trim()) * 1024; | |
}); | |
jQuery.get( "https://www.att.com/olam/billOverviewTiles.myworld", function( dollarData ) { | |
jQuery(dollarData).find('span.flipper.float-right.font14.top10px.padRight20.colorBlack').not('.ie7Top7').each(function(i) { | |
dollars.push(jQuery(this).text().trim()); | |
}); | |
console.log(data); | |
// console.log(dollars); | |
//return combineDollarsAndData(dollars, data); | |
}); | |
}); | |
function combineDollarsAndData(dollars, data){ | |
// Expected format | |
// dollars["Adam"] = 65 | |
// data["Adam"] = 4500 | |
var combined = {}; | |
for (var i in dollars) { | |
combined[dollars[i]] = data[i] | |
}; | |
return combined; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment