mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2025-03-14 23:10:08 +08:00
Add support for reading numRatings of guides
This commit is contained in:
parent
33bc8d83c9
commit
e23fa02c91
@ -24,6 +24,7 @@ SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
|
||||
uniqueVisitorsCount: null,
|
||||
favoritesCount: null,
|
||||
upvoteCount: null,
|
||||
guideNumRatings: null,
|
||||
isUpvoted: null,
|
||||
isDownvoted: null
|
||||
};
|
||||
@ -105,6 +106,12 @@ SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
|
||||
}
|
||||
|
||||
|
||||
// Find numRatings if this is a guide as they use a different voting system
|
||||
let numRatings = $(".ratingSection > .numRatings").text().replace(" ratings", "")
|
||||
|
||||
sharedfile.guideNumRatings = Number(numRatings) || null; // Set to null if not a guide or if the guide does not have enough ratings to show a value
|
||||
|
||||
|
||||
// Determine if this account has already voted on this sharedfile
|
||||
sharedfile.isUpvoted = String($(".workshopItemControlCtn > #VoteUpBtn")[0].attribs["class"]).includes("toggled"); // Check if upvote btn class contains "toggled"
|
||||
sharedfile.isDownvoted = String($(".workshopItemControlCtn > #VoteDownBtn")[0].attribs["class"]).includes("toggled"); // Check if downvote btn class contains "toggled"
|
||||
|
Loading…
Reference in New Issue
Block a user