Created
August 16, 2016 18:59
-
-
Save andymasteroffish/627e22cb7414dc1c786a59f59a14d4c2 to your computer and use it in GitHub Desktop.
steamdoesntknowwhatitwants.js
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 replaceMessage = "I do not know what I want."; | |
var replaceMessageHours = 24; | |
var reviews = document.getElementsByClassName("review_box"); | |
for (var i=0; i < reviews.length; i++) { | |
console.log("------- "+i+" --------"); | |
//get all divs containing reviews | |
var recomended = reviews[i].getElementsByClassName("title ellipsis")[0]; | |
//some are weird and hidden and will have no text for the recomended field. We want to skip those | |
if (recomended != undefined){ | |
//how many hours did they play? The string in this box starts with the hours logged | |
var hours = reviews[i].getElementsByClassName("hours ellipsis")[0]; | |
console.log(hours.innerHTML); | |
//turn it into a number | |
var splitString = hours.innerHTML.split(" "); | |
console.log(splitString[0]); | |
var hoursVal = parseFloat(splitString[0]); | |
//if they did not recomend and the played for more than a set amount, fuck with it. | |
if (recomended.innerHTML == "Not Recommended" && hoursVal > replaceMessageHours){ | |
//get the actual review and change it | |
var reviewText = reviews[i].getElementsByClassName("content")[0]; | |
console.log(reviewText.innerHTML); | |
reviewText.innerHTML = replaceMessage; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment