Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.80 KB | None | 0 0
  1. <!doctype html>
  2. <html class="no-js" lang="">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="x-ua-compatible" content="ie=edge">
  6. <title></title>
  7. <meta name="description" content="">
  8. <meta name="viewport" content="width=device-width, initial-scale=1">
  9. <link rel="apple-touch-icon" href="apple-touch-icon.png">
  10. <!-- Place favicon.ico in the root directory -->
  11. <style>
  12. ul#chat{
  13. height: 100px;
  14. overflow: scroll;
  15. }
  16. </style>
  17. </head>
  18. <body>
  19. <!--[if lte IE 9]>
  20. <p class="browserupgrade">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience and security.</p>
  21. <![endif]-->
  22. <!-- Add your site or application content here -->
  23. <p>Hello world! This is HTML5 Boilerplate.</p>
  24. <script src="https://code.jquery.com/jquery-3.1.0.min.js"></script>
  25. <script>window.jQuery || document.write('<script src="js/vendor/jquery-3.1.0.min.js"><\/script>')</script>
  26.  
  27.  
  28. <label> Your Nickname:</label> <input name="name" id="nickname">
  29. <ul id="chat">
  30.  
  31. </ul>
  32.  
  33.  
  34.  
  35. <textarea id="chatarea"></textarea>
  36.  
  37. <div id="story"> John generated blabellela</div>
  38.  
  39. </body>
  40.  
  41. <script>
  42. $("textarea").keyup(function(e){
  43. if((e.keyCode || e.which) == 13) { //Enter keycode
  44.  
  45. if($('#nickname').val().length == 0){
  46. alert('Please insert a nickname');
  47. }else{
  48. var text = $('#chatarea').val();
  49. $('#chat').append('<li> <span class=\"chatter\">' + $('#nickname').val() + ': </span>' + text + '</li>');
  50.  
  51. $('#chatarea').val('');
  52.  
  53. }
  54. }
  55.  
  56.  
  57.  
  58.  
  59. });
  60. (function() {
  61. var index = 0;
  62. var index2 = 0;
  63. var comments = [
  64. "Johnny: this sucks",
  65. "VanessaXXX: You suck, this website is the shit",
  66. "Jeffrey: Shut your piehole, Johnny"
  67. ];
  68.  
  69. var stories = [
  70. "vaneesa has gained",
  71. "VanessaXXX: You suck, this website is the shit",
  72. "Jeffrey: Shut your piehole, Johnny"
  73. ];
  74.  
  75.  
  76. window.setInterval(function(){
  77. $('#chat').append('<li> <span class=\"chatter\">' + comments[index] + '</li>');
  78. $('#chat').animate({scrollTop: $('#chat').prop("scrollHeight")}, 500);
  79. index = index + 1;
  80. index = index % comments.length;
  81. }, 2000);
  82. // story box
  83. window.setInterval(function(){
  84. $("#story").slideUp('slow', function() {
  85. $("#story").html(stories[index]);
  86. $("#story").slideDown('slow');
  87. });
  88. }, 3000);
  89. //$('#story').fadeTo(1000, 0, function(){ $(this).html().fadeTo(1000, 1); });
  90. })();
  91. </script>
  92. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement