Skip to content

Instantly share code, notes, and snippets.

@andymasteroffish
Created August 16, 2016 18:54
Show Gist options
  • Save andymasteroffish/ab51f1fe8c30806d973339ca214eceb0 to your computer and use it in GitHub Desktop.
Save andymasteroffish/ab51f1fe8c30806d973339ca214eceb0 to your computer and use it in GitHub Desktop.
var reviewNames = document.getElementsByClassName("customerReviewTitle");
var reviewText = document.getElementsByClassName("content");
var starAreas = document.getElementsByClassName("rating");
//console.log("got "+reviewText.length);
for (var i=0; i < reviewNames.length; i++) {
reviewNames[i].innerHTML = "This is an app.";
}
for (var i=0; i < reviewText.length; i++) {
//some images and things also have the content ID, so I only want things in the custome review area.
if (reviewText[i].parentNode.className == 'customer-review'){
reviewText[i].innerHTML = "I might have opened this app.";
}
}
for (var i=0; i < starAreas.length; i++){
//console.log("------ "+i+" -------");
//console.log(starAreas[i].innerHTML);
var newHTML = "";
newHTML += '<div>';
var numStars = 6 + Math.random()* 20;
if (Math.random() * 100 < 50){
numStars = 1;
}
for (var s=0; s<numStars; s++){
newHTML += '<span class="rating-star">&nbsp;</span>';
}
newHTML += '</div>';
starAreas[i].innerHTML = newHTML;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment