mirror of
https://github.com/DoctorMcKay/node-steamcommunity.git
synced 2026-08-22 14:43:29 +08:00
Add support for reading numRatings of guides
This commit is contained in:
@@ -24,6 +24,7 @@ SteamCommunity.prototype.getSteamSharedfile = function(sharedFileId, callback) {
|
|||||||
uniqueVisitorsCount: null,
|
uniqueVisitorsCount: null,
|
||||||
favoritesCount: null,
|
favoritesCount: null,
|
||||||
upvoteCount: null,
|
upvoteCount: null,
|
||||||
|
guideNumRatings: null,
|
||||||
isUpvoted: null,
|
isUpvoted: null,
|
||||||
isDownvoted: 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
|
// 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.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"
|
sharedfile.isDownvoted = String($(".workshopItemControlCtn > #VoteDownBtn")[0].attribs["class"]).includes("toggled"); // Check if downvote btn class contains "toggled"
|
||||||
|
|||||||
Reference in New Issue
Block a user