256 Kilobytes

[Article and Code] Are the "real time" comments on those ads for shitty mobile games real?

Articles in Web Development | By August R. Garcia

Published 9 months agoMon, 14 Jan 2019 04:20:51 -0800 | Last update 9 months agoMon, 14 Jan 2019 04:51:32 -0800

Answer: No, obviously.

418 views, 0 RAMs, and 0 comments

For example, here's some guy on an Internet forum asking for a "fake real time comments generator" on another internet forum:

Hey, I tried to search online about this but didn't find anything useful.

I need a piece of code (javascript or html/php) that generates random fake comments and display them. You get a better idea if you think about a landing page regarding a fake currency generator: in these landing page you see fake real time comments saying "wow, amazing", "it really works" "just received them!". In this way you can also implement another real time features like "User001 received 2000 coins" in order to make it more realistic.

All the comments should be in real time and not just static, otherwise I would just write some html text. I'm also thinking about ripping a LP with this feature and get the code, but if you already have it and could share, I would really appreciate it!

Source:  https://www.blackhatworld.com/seo/landing-page-fake-real-time-comments-generator.1073045/

Considering that these comments are, in fact, fake, how exactly do they work? While it can vary on a case by case basis, they are probably coded similarly to the code in this article below.

Fake Comments in Action

Latest Comments

The Full Code

<!DOCTYPE html>
<html>
<head>
<style>
/* Styles for the "comments"/comments */

/* Cosmetic CSS */
wrapper {
    background-color:ghostwhite;
    border:         1px solid darkgrey;
	box-sizing:     border-box;
}
wrapper heading1 {
	text-align:      center;
    font-size:       2em;
    font-family:     sans;
    display:         block;
    font-weight:     bold;
	padding:         0.50em;
    background-color:lightsteelblue;
    background:      linear-gradient(to bottom, darkgrey, grey);
    color:           white;
    text-shadow:     1px 1px 1px black;
} 

comment                          { background-color:snow; transition:background-color 0.75s;     }
comment:nth-child(odd)           { background-color:whitesmoke;                                  }
comment:not(:last-child)         { border-bottom:1px solid lavender;                             }
comment photo                    { background-color:beige; border:1px solid black;               }    

/* CSS for Layout */
wrapper                          { overflow:auto; display:block;                                 }
comments                         { display:block; overflow:auto;                                 }
comment                          { display: block; overflow: auto; padding: 0.25em 0.25em;       }

comment left, comment right      { overflow:visible; display: grid;                              }
comment left                     { margin-right: 0.25em;                                         }
comment right                    { margin-left:  0.25em;                                         }
comment name, comment timestamp  { font-weight:bold;                                             }
comment row                      { display:flex; justify-content:flex-start; align-items:center; }
comment photo {
	width:42px;	
	text-align:center;
    font-family:monospace;
    font-size:32px;
    padding:0.5em;
	margin: 0.1em;
	border-radius:50%;
}
</style>
</head>
<body>

<h1>Definitely a Real Product</h1>
<p>This are real comments from real people.</p>

<wrapper>
  <heading1>Latest Comments</heading1>
  <comments id="comments">
    <template>
      <comment>
          <row>
              <left>
                  <photo>J</photo>
              </left>
              <right>
                  <row>
                  	<name>John Smith</name>
                    &nbsp;at&nbsp;
                    <timestamp>01 January, 2019 at 03:36 AM</timestamp>
                  </row>
                  <reply>Here I am replying to this post.</reply>
              </right>
          </row>
      </comment>
    </template>
  </comments>
</wrapper>

<script>
var f_names = ["Sophia", "Jackson", "Emma", "Aiden", "Olivia", "Lucas", "Ava", "Liam", "Mia", "Noah", "Isabella", "Ethan", "Riley", "Mason", "Aria", "Caden", "Zoe", "Oliver", "Charlotte", "Elijah", "Lily", "Grayson", "Layla", "Jacob", "Amelia", "Michael", "Emily", "Benjamin", "Madelyn", "Carter", "Aubrey", "James", "Adalyn", "Jayden", "Madison", "Logan", "Chloe", "Alexander", "Harper", "Caleb", "Abigail", "Ryan", "Aaliyah", "Luke", "Avery", "Daniel", "Evelyn", "Jack", "Kaylee", "William", "Ella", "Owen", "Ellie", "Gabriel", "Scarlett", "Matthew", "Arianna", "Connor", "Hailey", "Jayce", "Nora", "Isaac", "Addison", "Sebastian", "Brooklyn", "Henry", "Hannah", "Muhammad", "Mila", "Cameron", "Leah", "Wyatt", "Elizabeth", "Dylan", "Sarah", "Nathan", "Eliana", "Nicholas", "Mackenzie", "Julian", "Peyton", "Eli", "Maria", "Levi", "Grace", "Isaiah", "Adeline", "Landon", "Elena", "David", "Anna", "Christian", "Victoria", "Andrew", "Camilla", "Brayden", "Lillian", "John", "Natalie", "Lincoln"];
var l_names = ["Smith", "Johnson", "Williams", "Jones", "Brown", "Davis", "Miller", "Wilson", "Moore", "Taylor", "Anderson", "Thomas", "Jackson", "White", "Harris", "Martin", "Thompson", "Garcia", "Martinez", "Robinson", "Clark", "Rodriguez", "Lewis", "Lee", "Walker", "Hall", "Allen", "Young", "Hernandez", "King", "Wright", "Lopez", "Hill", "Scott", "Green", "Adams", "Baker", "Gonzalez", "Nelson", "Carter", "Mitchell", "Perez", "Roberts", "Turner", "Phillips", "Campbell", "Parker", "Evans", "Edwards", "Collins", "Stewart", "Sanchez", "Morris", "Rogers", "Reed", "Cook", "Morgan", "Bell", "Murphy", "Bailey", "Rivera", "Cooper", "Richardson", "Cox", "Howard", "Ward", "Torres", "Peterson", "Gray", "Ramirez", "James", "Watson", "Brooks", "Kelly", "Sanders", "Price", "Bennett", "Wood", "Barnes", "Ross", "Henderson", "Coleman", "Jenkins", "Perry", "Powell", "Long", "Patterson", "Hughes", "Flores", "Washington", "Butler", "Simmons", "Foster", "Gonzales", "Bryant", "Alexander", "Russell", "Griffin", "Diaz", "Hayes"];
var comments = [
	"What a {great|nice|helpful} {post|article}.",
    "Very nice."       ,
    "This is {good|great}.",
    "What the fuck did you just say about me you little bitch I'll have you know I graduated top of my class in the Navy SEALs.",
    "10/10 post", "Absolutely not.", "Are we almost there?", "Are you coming with me?", "Are you sure?", "As soon as possible.", "Be careful driving.", "Be careful.", "Believe me.", "Buy it!", "Call me tomorrow.", "Can you speak slowly?", "Can you translate this for me?", "Chicago is very different from Boston.", "Come with me.", "Congratulations.", "Cucks stumpted", "Dear god, why...", "Do it right!", "Do you mean it?", "Do you see him often?", "Do you understand?", "Do you want it?", "Do you want something?", "Don't worry.", "Don’t do it.", "Don’t exaggerate.", "Don’t tell me that.", "Everyone knows it.", "Everything is ready.", "Excellent.", "From time to time.", "Give me a hand.", "Go right ahead.", "God bless this thread.", "Good idea.", "Guys, I may be a freshman undergrad, but I think I have an incredibly simple solution to a massively complex geopolitical problem of which I understand practically nothing yet think I understand completely. Let me offer this shitty allegory to help you understand.", "Have a good trip.", "Have a nice day.", "Have another one.", "Have you finished?", "He doesn’t have time.", "He is on his way.", "He likes it very much.", "He's coming soon.", "He's right.", "He's very annoying.", "He's very famous.", "Help!", "How are you doing?", "How are you?", "How long are you staying?", "How much?", "How's work going?", "Hurry!", "I am crazy about her.", "I am wasting my time.", "I ate already.", "I can do it.", "I can't hear you.", "I can’t believe it.", "I can’t wait.", "I don't know how to use it.", "I don't like him.", "I don't like it.", "I don't speak very well.", "I don't understand.", "I don't want it.", "I don't want that.", "I don't want to bother you.", "I don’t have time.", "I don’t know anybody.", "I don’t like it.", "I don’t think so.", "I feel good.", "I feel much better.", "I found it.", "I get off of work at 6.", "I hate you!", "I have a headache.", "I hope so.", "I hope you and your wife have a nice trip.", "I knew it.", "I know.", "I like her.", "I lost my watch.", "I love you.", "I need to change clothes.", "I need to go home.", "I noticed that.", "I only want a snack.", "I see.", "I think it tastes good.", "I think it's very good.", "I think so.", "I thought the clothes were cheaper.", "I want to speak with him.", "I was about to leave the restaurant when my friends arrived.", "I won.", "I would like a cup of coffee, please.", "I'd like to go for a walk.", "I'll call you when I leave.", "I'll come back later.", "I'll pay.", "I'll take it.", "I'll take you to the bus stop.", "I'm an American.", "I'm cleaning my room.", "I'm cold.", "I'm coming to pick you up.", "I'm going to leave.", "I'm good, and you?", "I'm happy.", "I'm hungry.", "I'm married.", "I'm not busy.", "I'm not married.", "I'm not ready yet.", "I'm not sure.", "I'm sorry, we're sold out.", "I'm thirsty.", "I'm very busy. I don't have time now.", "I've been here for two days.", "I've heard Texas is a beautiful place.", "I've never seen that before.", "I’ll miss you.", "I’ll try.", "I’m bored.", "I’m busy.", "I’m having fun.", "I’m hungry.", "I’m leaving.", "I’m ready.", "I’m sorry.", "I’m used to it.", "I’ve got it.", "If you need my help, please let me know.", "Is it far?", "Is Mr. Smith an American?", "Is that enough?", "It doesn’t matter.", "It smells good.", "It's longer than 2 miles.", "It’s about time.", "It’s all right.", "It’s different.", "It’s easy.", "It’s funny.", "It’s good.", "It’s impossible.", "It’s incredible!", "It’s near here.", "It’s not bad.", "It’s not difficult.", "It’s not worth it.", "It’s nothing.", "It’s obvious.", "It’s the same thing.", "It’s time to go.", "It’s your turn.", "Jesus Christ", "Just a little.", "Just a moment.", "Let me check.", "Let me think about it.", "Let's go have a look.", "Let's practice English.", "May I speak to Mrs. Smith please?", "Me too.", "More than that.", "Never mind.", "Next time.", "No, thank you.", "No.", "Nonsense.", "Not recently.", "Not yet.", "Nothing else.", "Of course.", "Okay.", "Please fill out this form.", "Please take me to this address.", "Please write it down.", "Really?", "Relax!", "Right here.", "Right there.", "See you later.", "See you tomorrow.", "See you tonight.", "She is my best friend.", "She is so smart.", "She's pretty.", "Slow down!", "Sorry to bother you.", "Stop!", "It's almost like Reddit is thousands of different people with thousands of different opinions.", "Take a chance.", "Take it outside.", "Tell me.", "Thank you miss.", "Thank you sir.", "Thank you very much.", "Thank you.", "Thanks for everything.", "Thanks for your help.", "That happens.", "That looks great.", "That smells bad.", "That's alright.", "That's enough.", "That's fine.", "That's it.", "That's not fair.", "That's not right.", "That's right.", "That's too bad.", "That's too many.", "That's too much.", "That’s enough.", "That’s interesting.", "That’s right.", "That’s true.", "The book is under the table.", "There are too many people here.", "They like each other.", "They'll be right back.", "They're the same.", "They're very busy.", "Think about it.", "This doesn't work.", "This is a quality thread.", "This is very difficult.", "This is very important.", "Too bad!", "Try it.", "Upvoted", "Very good, thanks.", "Wait for me.", "We like it very much.", "What did you say?", "What do you think?", "What is he talking about?", "What terrible weather!", "What’s going on/ happening / the problem?", "What’s the date today?", "Where are you going?", "Where is he?", "Whoosh", "Whoosh...", "Would you take a message please?", "Wow!", "Yes, really.", "You are impatient.", "You look tired.", "You surprise me.", "You're beautiful.", "You're very nice.", "You're very smart.", "You’re always right.", "You’re crazy.", "You’re in a bad mood.", "You’re lying.", "You’re welcome.", "You’re wrong.", "Your things are all here."
];

var month = new Array();
month[0] = "January";
month[1] = "February";
month[2] = "March";
month[3] = "April";
month[4] = "May";
month[5] = "June";
month[6] = "July";
month[7] = "August";
month[8] = "September";
month[9] = "October";
month[10] = "November";
month[11] = "December";


// @param   -- spintax. Required. String. A string of text marked up with spintax. 
// @example -- run_spintax("{What is|what's} the deal with {airline food|the food they give you on airplanes}?")
//       https://www.256kilobytes.com/content/show/1937/the-ultimate-guide-to-spintax-overview-formatting-and-running-spintax-in-google-sheets-and-javascript-in-general
function run_spintax(spintax) { 

  // Define a variable to store a REGEX that will match all spintax instances  
  var regex = new RegExp(/{([^{}]+?)}/);

  // Loop through all spintax instances  
  while((to_spin = regex.exec(spintax)) !== null) { 
    // Break the current spintax match from a string into an array split on the pipe character
    opts = to_spin[1].split("|"); 

    // Get a random option from the spintax options
    random = Math.floor(Math.random() * opts.length); 

    // Replace the full spintax string with the chosen option 
    spintax = spintax.replace(to_spin[0], opts[random]); 
  }
  
  return spintax;
}

function rand_between(min, max) { return Math.round(Math.random() * (max - min) ) + min; }

function load_new_comment() {
	// Clone the template 
    var temp = document.getElementsByTagName("template")[0];

    // Set the new comment's attributes
    var f_name = f_names[Math.floor(Math.random()*f_names.length)];
    var l_name = l_names[Math.floor(Math.random()*l_names.length)];
 	var name = f_name + " " + l_name; 
    var letter = name.charAt(0);

	// ***** Handle the Timestamp ***** //
	// That feel when you have to handle datetimes in JavaScript
	var ts        = new Date();

	// Convert from military time to AM/PM    
	var hrs = ts.getHours(); am_pm = "AM";
    if (hrs > 12) { hrs -= 12; am_pm = "PM"; }
    var mins = ts.getMinutes(); 
    var day  = ts.getDay();
    
    // Fix leading zeroes
    hrs  = (hrs <10?'0':'') + hrs ; 
    mins = (mins<10?'0':'') + mins;  
    day  = (day <10?'0':'') + day;  
    
    // Create a human-readable string for the date 
    var timestamp = day   + " " + month[ts.getMonth()] + ", " + ts.getFullYear() + " at " 
                  + hrs   + ":" + mins                 + " "  + am_pm; 

	// Get a random comment 
    var comment = comments[Math.floor(Math.random()*comments.length)];
    
    // If the comment has spintax markup in it, execute it here
	var comment = run_spintax(comment); 

	// Actually set the fields in the template with the data for the new comment 
	temp.content.querySelector("name").textContent       = name;
	temp.content.querySelector("timestamp").textContent  = timestamp;
	temp.content.querySelector("photo").textContent      = letter;
	temp.content.querySelector("reply").textContent      = comment;

	// Generate random color pairs for the user letter icons  
    // Similar to the method used here:
    //       https://www.256kilobytes.com/content/show/494/php-how-to-generate-random-readable-background-and-text-color-pairs
    var r         = rand_between(128,255); 	var rt = r-128; 
    var b         = rand_between(128,255);	var bt = b-128; 
    var g         = rand_between(128,255);	var gt = g-128; 
    var bg        = "rgba("+r +", "+g +", "+b +", 1.0)";
    var txt       = "rgba("+rt+", "+gt+", "+bt+", 1.0)";
    var bg_outer  = "rgba("+r+", "+g+", "+b+", 1.0)";
    var bg_inner  = "rgba("+r+", "+g+", "+b+", 0.8)";    
   
    var bg_gradient = "radial-gradient("+bg_inner+", "+bg_outer+")";
    temp.content.querySelector("photo").style.color           = txt;
    temp.content.querySelector("photo").style.borderColor     = txt;
    temp.content.querySelector("photo").style.backgroundColor = bg;
    temp.content.querySelector("photo").style.background      = bg_gradient;

	// Insert the new object
    var clon = temp.content.cloneNode(true); 
    var list = document.getElementById("comments");
    list.insertBefore(clon, list.childNodes[0]);
}

// Load in some comments initially 
for (var iii = 0; iii < rand_between(1,10); ++iii) 
	load_new_comment();

// Then load in new comments at random intervals 
setInterval(function(){
	load_new_comment();
}, rand_between(1000,15000) ); // Repeat every 1 to 15 seconds 

</script>

</body>
</html>

Code Breakdown

HTML: Create the Comments Section

These are custom XML tags. Arbitrary XML tags can be used in HTML documents, although they have no styles by default. Make sure to define their styles and other behavior elsewhere in your code.

<wrapper>
  <heading1>Latest Comments</heading1>
  <comments id="comments">
    <template>
      <comment>
          <row>
              <left>
                  <photo>J</photo>
              </left>
              <right>
                  <row>
                  	<name>John Smith</name>
                    &nbsp;at&nbsp;
                    <timestamp>01 January, 2019 at 03:36 AM</timestamp>
                  </row>
                  <reply>Here I am replying to this post.</reply>
              </right>
          </row>
      </comment>
    </template>
  </comments>
</wrapper>

CSS: Styles for the Comments/"Comments"

/* Cosmetic CSS */
wrapper {
    background-color:ghostwhite;
    border:         1px solid darkgrey;
	box-sizing:     border-box;
}
wrapper heading1 {
	text-align:      center;
    font-size:       2em;
    font-family:     sans;
    display:         block;
    font-weight:     bold;
	padding:         0.50em;
    background-color:lightsteelblue;
    background:      linear-gradient(to bottom, darkgrey, grey);
    color:           white;
    text-shadow:     1px 1px 1px black;
} 

comment                          { background-color:snow; transition:background-color 0.75s;     }
comment:nth-child(odd)           { background-color:whitesmoke;                                  }
comment:not(:last-child)         { border-bottom:1px solid lavender;                             }
comment photo                    { background-color:beige; border:1px solid black;               }    

/* CSS for Layout */
wrapper                          { overflow:auto; display:block;                                 }
comments                         { display:block; overflow:auto;                                 }
comment                          { display: block; overflow: auto; padding: 0.25em 0.25em;       }

comment left, comment right      { overflow:visible; display: grid;                              }
comment left                     { margin-right: 0.25em;                                         }
comment right                    { margin-left:  0.25em;                                         }
comment name, comment timestamp  { font-weight:bold;                                             }
comment row                      { display:flex; justify-content:flex-start; align-items:center; }
comment photo {
	width:42px;	
	text-align:center;
    font-family:monospace;
    font-size:32px;
    padding:0.5em;
	margin: 0.1em;
	border-radius:50%;
}

JavaScript

Define Data to Pull From

If you want to tryhard, you could instead store this data in a database somewhere and grab it asynchronously. Data used here is from:

var f_names = ["Sophia", "Jackson", "Emma", "Aiden", "Olivia", "Lucas", "Ava", "Liam", "Mia", "Noah", "Isabella", "Ethan", "Riley", "Mason", "Aria", "Caden", "Zoe", "Oliver", "Charlotte", "Elijah", "Lily", "Grayson", "Layla", "Jacob", "Amelia", "Michael", "Emily", "Benjamin", "Madelyn", "Carter", "Aubrey", "James", "Adalyn", "Jayden", "Madison", "Logan", "Chloe", "Alexander", "Harper", "Caleb", "Abigail", "Ryan", "Aaliyah", "Luke", "Avery", "Daniel", "Evelyn", "Jack", "Kaylee", "William", "Ella", "Owen", "Ellie", "Gabriel", "Scarlett", "Matthew", "Arianna", "Connor", "Hailey", "Jayce", "Nora", "Isaac", "Addison", "Sebastian", "Brooklyn", "Henry", "Hannah", "Muhammad", "Mila", "Cameron", "Leah", "Wyatt", "Elizabeth", "Dylan", "Sarah", "Nathan", "Eliana", "Nicholas", "Mackenzie", "Julian", "Peyton", "Eli", "Maria", "Levi", "Grace", "Isaiah", "Adeline", "Landon", "Elena", "David", "Anna", "Christian", "Victoria", "Andrew", "Camilla", "Brayden", "Lillian", "John", "Natalie", "Lincoln"];
var l_names = ["Smith", "Johnson", "Williams", "Jones", "Brown", "Davis", "Miller", "Wilson", "Moore", "Taylor", "Anderson", "Thomas", "Jackson", "White", "Harris", "Martin", "Thompson", "Garcia", "Martinez", "Robinson", "Clark", "Rodriguez", "Lewis", "Lee", "Walker", "Hall", "Allen", "Young", "Hernandez", "King", "Wright", "Lopez", "Hill", "Scott", "Green", "Adams", "Baker", "Gonzalez", "Nelson", "Carter", "Mitchell", "Perez", "Roberts", "Turner", "Phillips", "Campbell", "Parker", "Evans", "Edwards", "Collins", "Stewart", "Sanchez", "Morris", "Rogers", "Reed", "Cook", "Morgan", "Bell", "Murphy", "Bailey", "Rivera", "Cooper", "Richardson", "Cox", "Howard", "Ward", "Torres", "Peterson", "Gray", "Ramirez", "James", "Watson", "Brooks", "Kelly", "Sanders", "Price", "Bennett", "Wood", "Barnes", "Ross", "Henderson", "Coleman", "Jenkins", "Perry", "Powell", "Long", "Patterson", "Hughes", "Flores", "Washington", "Butler", "Simmons", "Foster", "Gonzales", "Bryant", "Alexander", "Russell", "Griffin", "Diaz", "Hayes"];
var comments = [
	"What a {great|nice|helpful} {post|article}.",
    "Very nice."       ,
    "This is {good|great}.",
    "What the fuck did you just say about me you little bitch I'll have you know I graduated top of my class in the Navy SEALs.",
    "10/10 post", "Absolutely not.", "Are we almost there?", "Are you coming with me?", "Are you sure?", "As soon as possible.", "Be careful driving.", "Be careful.", "Believe me.", "Buy it!", "Call me tomorrow.", "Can you speak slowly?", "Can you translate this for me?", "Chicago is very different from Boston.", "Come with me.", "Congratulations.", "Cucks stumpted", "Dear god, why...", "Do it right!", "Do you mean it?", "Do you see him often?", "Do you understand?", "Do you want it?", "Do you want something?", "Don't worry.", "Don’t do it.", "Don’t exaggerate.", "Don’t tell me that.", "Everyone knows it.", "Everything is ready.", "Excellent.", "From time to time.", "Give me a hand.", "Go right ahead.", "God bless this thread.", "Good idea.", "Guys, I may be a freshman undergrad, but I think I have an incredibly simple solution to a massively complex geopolitical problem of which I understand practically nothing yet think I understand completely. Let me offer this shitty allegory to help you understand.", "Have a good trip.", "Have a nice day.", "Have another one.", "Have you finished?", "He doesn’t have time.", "He is on his way.", "He likes it very much.", "He's coming soon.", "He's right.", "He's very annoying.", "He's very famous.", "Help!", "How are you doing?", "How are you?", "How long are you staying?", "How much?", "How's work going?", "Hurry!", "I am crazy about her.", "I am wasting my time.", "I ate already.", "I can do it.", "I can't hear you.", "I can’t believe it.", "I can’t wait.", "I don't know how to use it.", "I don't like him.", "I don't like it.", "I don't speak very well.", "I don't understand.", "I don't want it.", "I don't want that.", "I don't want to bother you.", "I don’t have time.", "I don’t know anybody.", "I don’t like it.", "I don’t think so.", "I feel good.", "I feel much better.", "I found it.", "I get off of work at 6.", "I hate you!", "I have a headache.", "I hope so.", "I hope you and your wife have a nice trip.", "I knew it.", "I know.", "I like her.", "I lost my watch.", "I love you.", "I need to change clothes.", "I need to go home.", "I noticed that.", "I only want a snack.", "I see.", "I think it tastes good.", "I think it's very good.", "I think so.", "I thought the clothes were cheaper.", "I want to speak with him.", "I was about to leave the restaurant when my friends arrived.", "I won.", "I would like a cup of coffee, please.", "I'd like to go for a walk.", "I'll call you when I leave.", "I'll come back later.", "I'll pay.", "I'll take it.", "I'll take you to the bus stop.", "I'm an American.", "I'm cleaning my room.", "I'm cold.", "I'm coming to pick you up.", "I'm going to leave.", "I'm good, and you?", "I'm happy.", "I'm hungry.", "I'm married.", "I'm not busy.", "I'm not married.", "I'm not ready yet.", "I'm not sure.", "I'm sorry, we're sold out.", "I'm thirsty.", "I'm very busy. I don't have time now.", "I've been here for two days.", "I've heard Texas is a beautiful place.", "I've never seen that before.", "I’ll miss you.", "I’ll try.", "I’m bored.", "I’m busy.", "I’m having fun.", "I’m hungry.", "I’m leaving.", "I’m ready.", "I’m sorry.", "I’m used to it.", "I’ve got it.", "If you need my help, please let me know.", "Is it far?", "Is Mr. Smith an American?", "Is that enough?", "It doesn’t matter.", "It smells good.", "It's longer than 2 miles.", "It’s about time.", "It’s all right.", "It’s different.", "It’s easy.", "It’s funny.", "It’s good.", "It’s impossible.", "It’s incredible!", "It’s near here.", "It’s not bad.", "It’s not difficult.", "It’s not worth it.", "It’s nothing.", "It’s obvious.", "It’s the same thing.", "It’s time to go.", "It’s your turn.", "Jesus Christ", "Just a little.", "Just a moment.", "Let me check.", "Let me think about it.", "Let's go have a look.", "Let's practice English.", "May I speak to Mrs. Smith please?", "Me too.", "More than that.", "Never mind.", "Next time.", "No, thank you.", "No.", "Nonsense.", "Not recently.", "Not yet.", "Nothing else.", "Of course.", "Okay.", "Please fill out this form.", "Please take me to this address.", "Please write it down.", "Really?", "Relax!", "Right here.", "Right there.", "See you later.", "See you tomorrow.", "See you tonight.", "She is my best friend.", "She is so smart.", "She's pretty.", "Slow down!", "Sorry to bother you.", "Stop!", "It's almost like Reddit is thousands of different people with thousands of different opinions.", "Take a chance.", "Take it outside.", "Tell me.", "Thank you miss.", "Thank you sir.", "Thank you very much.", "Thank you.", "Thanks for everything.", "Thanks for your help.", "That happens.", "That looks great.", "That smells bad.", "That's alright.", "That's enough.", "That's fine.", "That's it.", "That's not fair.", "That's not right.", "That's right.", "That's too bad.", "That's too many.", "That's too much.", "That’s enough.", "That’s interesting.", "That’s right.", "That’s true.", "The book is under the table.", "There are too many people here.", "They like each other.", "They'll be right back.", "They're the same.", "They're very busy.", "Think about it.", "This doesn't work.", "This is a quality thread.", "This is very difficult.", "This is very important.", "Too bad!", "Try it.", "Upvoted", "Very good, thanks.", "Wait for me.", "We like it very much.", "What did you say?", "What do you think?", "What is he talking about?", "What terrible weather!", "What’s going on/ happening / the problem?", "What’s the date today?", "Where are you going?", "Where is he?", "Whoosh", "Whoosh...", "Would you take a message please?", "Wow!", "Yes, really.", "You are impatient.", "You look tired.", "You surprise me.", "You're beautiful.", "You're very nice.", "You're very smart.", "You’re always right.", "You’re crazy.", "You’re in a bad mood.", "You’re lying.", "You’re welcome.", "You’re wrong.", "Your things are all here."
];

Define Helper Functions

Spintax function discussed in more depth here:

// Used later to convert date numbers to readable months
var month = new Array();
month[0] = "January";
month[1] = "February";
month[2] = "March";
month[3] = "April";
month[4] = "May";
month[5] = "June";
month[6] = "July";
month[7] = "August";
month[8] = "September";
month[9] = "October";
month[10] = "November";
month[11] = "December";

// @param   -- spintax. Required. String. A string of text marked up with spintax. 
// @example -- run_spintax("{What is|what's} the deal with {airline food|the food they give you on airplanes}?")
function run_spintax(spintax) { 

  // Define a variable to store a REGEX that will match all spintax instances  
  var regex = new RegExp(/{([^{}]+?)}/);

  // Loop through all spintax instances  
  while((to_spin = regex.exec(spintax)) !== null) { 
    // Break the current spintax match from a string into an array split on the pipe character
    opts = to_spin[1].split("|"); 

    // Get a random option from the spintax options
    random = Math.floor(Math.random() * opts.length); 

    // Replace the full spintax string with the chosen option 
    spintax = spintax.replace(to_spin[0], opts[random]); 
  }
  
  return spintax;
}

// Self explanatory 
function rand_between(min, max) { return Math.round(Math.random() * (max - min) ) + min; }

Define the Main Function

This is the function that is called to load in a new random comment. It is called a random number of times (1 to 10) on pageload and then called again once at a randomly selected interval between 1 and 15 seconds.

function load_new_comment() {
	// Clone the template 
    var temp = document.getElementsByTagName("template")[0];

    // Set the new comment's attributes
    var f_name = f_names[Math.floor(Math.random()*f_names.length)];
    var l_name = l_names[Math.floor(Math.random()*l_names.length)];
 	var name = f_name + " " + l_name; 
    var letter = name.charAt(0);

	// ***** Handle the Timestamp ***** //
	// That feel when you have to handle datetimes in JavaScript
	var ts        = new Date();

	// Convert from military time to AM/PM    
	var hrs = ts.getHours(); am_pm = "AM";
    if (hrs > 12) { hrs -= 12; am_pm = "PM"; }
    var mins = ts.getMinutes(); 
    var day  = ts.getDay();
    
    // Fix leading zeroes
    hrs  = (hrs <10?'0':'') + hrs ; 
    mins = (mins<10?'0':'') + mins;  
    day  = (day <10?'0':'') + day;  
    
    // Create a human-readable string for the date 
    var timestamp = day   + " " + month[ts.getMonth()] + ", " + ts.getFullYear() + " at " 
                  + hrs   + ":" + mins                 + " "  + am_pm; 

	// Get a random comment 
    var comment = comments[Math.floor(Math.random()*comments.length)];
    
    // If the comment has spintax markup in it, execute it here
	var comment = run_spintax(comment); 

	// Actually set the fields in the template with the data for the new comment 
	temp.content.querySelector("name").textContent       = name;
	temp.content.querySelector("timestamp").textContent  = timestamp;
	temp.content.querySelector("photo").textContent      = letter;
	temp.content.querySelector("reply").textContent      = comment;

	// Generate random color pairs for the user letter icons  
    // Similar to the method used here:
    //       https://www.256kilobytes.com/content/show/494/php-how-to-generate-random-readable-background-and-text-color-pairs
	var r         = rand_between(128,255); 	var rt = r-128; 
    var b         = rand_between(128,255);	var bt = b-128; 
    var g         = rand_between(128,255);	var gt = g-128; 
    var bg        = "rgba("+r +", "+g +", "+b +", 1.0)";
    var txt       = "rgba("+rt+", "+gt+", "+bt+", 1.0)";
    var bg_outer  = "rgba("+r+", "+g+", "+b+", 1.0)";
    var bg_inner  = "rgba("+r+", "+g+", "+b+", 0.8)";    
   
	var bg_gradient = "radial-gradient("+bg_inner+", "+bg_outer+")";
	temp.content.querySelector("photo").style.color           = txt;
	temp.content.querySelector("photo").style.borderColor     = txt;
	temp.content.querySelector("photo").style.backgroundColor = bg;
	temp.content.querySelector("photo").style.background      = bg_gradient;

    // asdf [] 
    var clon = temp.content.cloneNode(true);

	// Insert the new object
    var list = document.getElementById("comments");
	list.insertBefore(clon, list.childNodes[0]);
}

Run the Code

// Load in some comments initially 
for (var iii = 0; iii < rand_between(1,10); ++iii) 
	load_new_comment();

// Then load in new comments at random intervals 
setInterval(function(){
	load_new_comment();
}, rand_between(1000,15000) ); // Repeat every 1 to 15 seconds 

In Conclusion

If you see some advertisement that has "real time" comments being loaded in, they are not necessarily from real humans. A reasonably competent computer programmer / web developer can set up a fake comment stream from scratch within a few hours at most.

Download more RAM. 🐏 ⨉ 0 Posted by August R. Garcia 9 months ago

Edit History

• [2019-01-14 4:20 PST] August R. Garcia (9 months ago)
• [2019-01-14 4:20 PST] August R. Garcia (9 months ago)
• [2019-01-14 4:20 PST] August R. Garcia (9 months ago)
• [2019-01-14 4:20 PST] August R. Garcia (9 months ago)
• [2019-01-14 4:20 PST] August R. Garcia (9 months ago)
• [2019-01-14 4:20 PST] August R. Garcia (9 months ago)
🕓 Posted at 14 January, 2019 04:20 AM PST
Profile Photo - August R. Garcia August R. Garcia LARPing as a Sysadmi... Portland, OR
🗎 192 🗨 948 🐏 287
Site Owner

Grahew Mattham

August Garcia is some guy who used to sell Viagra on the Internet. He made this website to LARP as a sysadmin while posting about garbage like user-agent spoofing, spintax, the only good keyboard, virtual assitants from Pakistan, links with the rel="nofollow" attributeproxiessin, the developer console, literally every link building method, and other junk.

Available at arg@256kilobytes.com, via Twitter, or arg.256kilobytes.com. Open to business inquiries based on availability.


Account created 10 months ago.
192 posts, 948 comments, and 287 RAMs.

Last active 1 hour ago:
Commented in thread Quality Content Dump: The Thread

Post a New Comment

To leave a comment, login to your account or create an account.

Do you like having a good time?

Read Quality Articles

Read some quality articles. If you can manage to not get banned for like five minutes, you can even post your own articles.

View Articles →

Argue with People on the Internet

Use your account to explain why people are wrong on the Internet forum.

View Forum →

Vandalize the Wiki

Or don't. I'm not your dad.

View Wiki →

Ask and/or Answer Questions

If someone asks a terrible question, post a LMGTFY link.

View Answers →

Make Some Money

Hire freelancers and/or advertise your goods and/or services. Hire people directly. We're not a middleman or your dad. Manage your own business transactions.

Register an Account
You can also login to an existing account or recover your password. All use of this site is subject to terms outlined in the terms of service and privacy policy.