Advertisement
Guest User

Untitled

a guest
Mar 17th, 2018
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.32 KB | None | 0 0
  1. <html lang="en"><head>
  2. <title>Animal Jam | Official Mod </title>
  3. <script type="text/javascript" src="/socket.io/socket.io.js"></script>
  4. <!--The above library(/socket.io/socket.io.js) will be generated by socket.io module of server -->
  5. <script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
  6.  
  7. <link rel="stylesheet" media="screen" href="https://ajwebcdn1.akamaized.net/assets/2.0/main-91475b0eba3490d3394bacd04d3653ef8822d80feb78bad48e45d3c2c840cd4d.css">
  8. <link rel="icon" href="https://ajwebcdn1.akamaized.net/assets/2.0/favicon/favicon-32x32-5407fe7fe85e9b2a11c1502a4ad5bd44b9239bdf54093a941e7d75e43ac95f04.png"
  9. <style></style></head>
  10.  
  11. <body style="">
  12.  
  13. <form>
  14.  
  15.  
  16.  
  17.  
  18. <!--text form to send data to the server-->
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25. <style>
  26. body {background: url(https://i.gyazo.com/f4af0963edf92d891425d1082364aee8.png); background-size: 100%;}
  27. </style>
  28.  
  29. <input type="text" placeholder="Username
  30. " id="messagee" style="
  31. margin-bottom: 0px;
  32. margin-top: 15px;
  33. padding-top: 4px;
  34. padding-bottom: 4px;
  35. padding-left: 0px;
  36. padding-right: 0px;
  37. margin-left: 225px;
  38. width: 200px;
  39. ">
  40.  
  41. <input type="text" placeholder="ID
  42. " id="messagee2" style="
  43. margin-bottom: 0px;
  44. margin-top: 15px;
  45. padding-top: 4px;
  46. padding-bottom: 4px;
  47. padding-left: 0px;
  48. padding-right: 0px;
  49. margin-left: 83px;
  50. width: 50px;
  51. ">
  52.  
  53. <input id="submitt" type="button" value="Send String" style="
  54. padding-bottom: 20px;
  55. padding-bottom: 20px;
  56. display: inline-block;
  57. color: #236082;
  58. font-weight: bold;
  59. text-align: center;
  60. text-decoration: none;
  61. background-color: #2374cc;
  62. background-image: linear-gradient(0deg, #4bbbee 0%, #43a9d3 53.4%, #35dddc 53.5%, #44c6dd 98%);
  63. cursor: pointer;
  64. font-family: Tiki-Island;
  65. font-weight: normal;
  66. font-size: 20px;
  67. line-height: 32px;
  68. letter-spacing: 1px;
  69. height: 40px;
  70. border-radius: 82px;
  71. margin-top: 13px;
  72. border-top-width: 2px;
  73. margin-left: 415px;
  74.  
  75. ">
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. <style></style><div style="height: 500px;width: 785px;overflow-y: scroll;background-color:;padding-bottom: 0px;margin-bottom: 305px;opacity: 0.7;margin-top: 120px;font-size: 25px;font-weight: bold;margin-left: 80px;" id="content"><p></p>
  84. </div></form>
  85.  
  86.  
  87.  
  88. <script type="text/javascript">
  89. var socket = io.connect("/");
  90. /*Initializing the connection with the server via websockets */
  91. socket.on("message",function(message){
  92. /*
  93. When server sends data to the client it will trigger "message" event on the client side , by
  94. using socket.on("message") , one cna listen for the ,message event and associate a callback to
  95. be executed . The Callback function gets the dat sent from the server
  96. */
  97. console.log("Message from the server arrived")
  98. console.log(message); /*converting the data into JS object */
  99. $('#content').append('<div >'+message.data+'</div>'); /*appending the data on the page using Jquery */
  100. });
  101. // SENDS TO CLIENT
  102. $(function(){
  103. $('#submit').click(function(){ /*listening to the button click using Jquery listener*/
  104. var data1 = { /*creating a Js ojbect to be sent to the server*/
  105. message:$('#message').val(), /*getting the text input data */
  106. }
  107. console.log("Sending");
  108. console.log(data1);
  109. socket.send(JSON.stringify(data1));
  110. /*Data can be sent to server very easily by using socket.send() method
  111. The data has to be changed to a JSON before sending
  112. it (JSON.stringify() does this job )*/
  113. /* This triggers a message event on the server side
  114. and the event handler obtains the data sent */
  115. $('#message').val('');
  116. //Emptying the text box value using jquery
  117. });
  118. });
  119. //SENDS TO SERVER
  120. $(function(){
  121. $('#submitt').click(function(){ /*listening to the button click using Jquery listener*/
  122. var data2 = { /*creating a Js ojbect to be sent to the server*/
  123. messagee:$('#messagee').val(), /*getting the text input data */
  124. }
  125. console.log("Sending");
  126. console.log(data2);
  127. socket.send(JSON.stringify(data2));
  128. /*Data can be sent to server very easily by using socket.send() method
  129. The data has to be changed to a JSON before sending
  130. it (JSON.stringify() does this job )*/
  131. /* This triggers a message event on the server side
  132. and the event handler obtains the data sent */
  133. //Emptying the text box value using jquery
  134. });
  135. });
  136. // REPLACE TEXT
  137. $(function() {
  138. $('#submiter').click(function () {
  139. var data3 = {
  140. replace1:$("#replace1").val(), replace2:$("#replace2").val()
  141. }
  142. console.log("Sending");
  143. console.log(data3);
  144. socket.send(JSON.stringify(data3));
  145. $('#replace1').val('');
  146. $('#replace2').val('');
  147. });
  148. });
  149. </script>
  150.  
  151. </body></html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement