Created
October 8, 2010 04:22
-
-
Save chapel/616353 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
exports.jqwindow = function(agent, ratingSel, userSel, callback) { | |
var window = jsdom.jsdom(agent.body).createWindow(); | |
jsdom.jQueryify(window, './jquery.js', function (window, jquery) { | |
var ratings = []; | |
var userRating; | |
window.jQuery(ratingSel).each(function () { | |
ratings.push(this.innerHTML.trim()); | |
}); | |
window.jQuery(userSel).each(function () { | |
console.log(this.innerHTML.trim()); | |
userRating = this.innerHTML.trim(); | |
}); | |
callback (ratings, userRating); | |
}); | |
} | |
exports.gamestats = function (agent) { | |
ratingValue = function (ratings, userRating) { | |
console.log(ratings); | |
console.log('user rating: '+userRating); | |
} | |
exports.jqwindow(agent, 'td[id$=arenaRating]', '.current_selected_player_row td[id$=arenaRating]', ratingValue); | |
//ratings.sort(compare); | |
//exports.jqwindow(agent, '.current_selected_player_row > td[id$=arenaRating]', selected); | |
//console.log(selected.query, ratings.query); | |
agent.next(); | |
function compare(a,b){ | |
return b-a; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment