>

Thêm shoutbox lịch sử

Ô 1:

TWIG
  1. {%set f=api.r.get('f') is not empty?'f='~api.r.get('f'):''%}
  2. <div class="waper">
  3. <div class="title"><a href="main.php?{{f}}"><b>Chatbox</b></a> · <a href="chat.php?chan=123456&id=view&on=0">Chat/Poker (0)</a> · <a href="/chat.php?chan=123456&id=smiles">Smile</a></div>
  4. <div id="error"></div>
  5. <div class="menu">
  6. <form action="{{form_url}}" method="post" id="form_chatbox">
  7. <table width="100%">
  8. <tbody><tr valign="top">
  9. <td width="80%">
  10. <textarea rows="3" cols="20" name="text" style="width:95%" id="chat_input"></textarea>
  11. </td>
  12. <td width="20%" class="nohover">
  13. <input type="submit" value="Gửi" id="chat_submit" required="">
  14. </td>
  15. </tr>
  16. </tbody></table>
  17. </form>
  18. </div>
  19.  
  20. <div class="left" style="padding:0px">
  21. <div class="list_chatbox" id="list_chatbox">
  22. {{message_list}}
  23. </div>
  24. </div>
  25.  
  26.  
  27. </div>
  28.  
  29. <script src="/files/1020011/jquery.min.js"></script>
  30. <script type="text/javascript">
  31. browser='{{api.r.createFromGlobals().cookies.get('v')=='3'?'web':'wap'}}';
  32. </script>
  33. <script type="text/javascript">
  34. var chat_link=location.href;
  35. if(browser=='web'){var timeload=1990}else{var timeload=10990}
  36. $(document).ready(function(){
  37. autoload=setInterval(chatbox_reload,timeload);
  38. $('#form_chatbox').submit(function(e){
  39. e.preventDefault();
  40. $('#chat_submit').val('\u0110ang g\u1eedi...').attr('disabled','');
  41. var c=$(this);
  42. var d=c.attr('action');
  43. var f=c.find('#chat_input').val();
  44. var g=f.length;
  45. if(g<2||g>10000){$('#error').html('<div class="noti">\u0110\u1ed9 d\xe0i tin nh\u1eafn l\xe0 t\u1eeb 2 \u0111\u1ebfn 10000 k\xfd t\u1ef1!</div>').fadeIn(200).delay(2000).fadeOut(1);
  46. $('#chat_submit').val('G\u1eedi').removeAttr('disabled','');return}else{
  47. $.post(d,{text:f},function(a,b){if(b=='error'){$('#error').html('<div class="noti">Error: Cannot sending</div>').fadeIn(200).delay(3000).fadeOut(1);$('#chat_submit').val('G\u1eedi').removeAttr('disabled','');return};if(b=='success'){$('#chat_input').val('');$('#chat_submit').val('G\u1eedi').removeAttr('disabled','');chatbox_reload()}});return false}});$('#paging_def').delegate('a.plink','click',function(e){e.preventDefault();var b=$(this).attr('href');$.ajax({type:"GET",url:b,success:function(a){list_chat=$(a).find('#list_chatbox').html();$('#list_chatbox').html(list_chat)}})});if(browser=='web'){$('#chat_input').keypress(function(e){if((e.keyCode==10||e.keyCode==13)&&!e.shiftKey){e.preventDefault();$('#form_chatbox').trigger('submit')}})}function chatbox_reload(){if(autoload){clearTimeout(autoload)}$.ajax({type:"GET",url:chat_link,success:function(a){list_chat=$(a).find('#list_chatbox').html();if($('#list_chatbox').html()!=list_chat){$('#list_chatbox').html(list_chat)}if(list_chat.indexOf('<span id="new_post"></span>')>-1){if(browser=='web'){var b=new Audio('/files/1005357/new.mp3');}else{navigator.vibrate=navigator.vibrate||navigator.webkitVibrate||navigator.mozVibrate||navigator.msVibrate};if(browser=='web'){b.play();}else if(navigator.vibrate){navigator.vibrate(500)}}}});
  48.  
  49. autoload=setInterval(chatbox_reload,timeload)};
  50.  
  51. $('#list_chatbox').delegate('a#cmt_link','click',function(e){e.preventDefault();var a=$(this).attr('data-id');$('#chat_input').val(a+' ');$('#chat_input').focus()});$('#list_chatbox').delegate('a#reply_cmt','click',function(e){e.preventDefault();var a=$(this).attr('data-id');var b=$(this).attr('data-ans');$('#chat_input').val(a+' '+b+' ');$('#chat_input').focus()})});
  52. </script>
  53.  
  54. <style type="text/css">
  55. * {
  56. padding: 0;
  57. margin: 0;
  58. }
  59. body {
  60. word-wrap: break-word;
  61. padding: 0;
  62. color: #000;
  63. background: #eee;
  64. font-family: Arial,Tahoma,sans-serif;
  65. font-size: small;
  66. word-wrap: break-word;
  67. max-width: 700px;
  68. margin: auto;
  69. }
  70. .title a {
  71. color: #fefef0;
  72. }
  73. a:hover {
  74. text-decoration: underline;
  75. color: #f00;
  76. font-style: normal;
  77. }
  78.  
  79. ::-webkit-resizer {
  80. background-color: #06f;
  81. }
  82. .wapper {
  83. padding: 5px;
  84. }
  85. .wapper {
  86. background: #fff;
  87. }
  88.  
  89. .menu {
  90. border: 1px solid #dfdfdf;
  91. border-top: 0px;
  92. background: #fff;
  93. padding: 6px;
  94. margin: 0;
  95. }
  96. .title {
  97. background-color: #066;
  98. color: #fff;
  99. text-align: left;
  100. background-repeat: repeat-x;
  101. margin: 5px 0px 0px 0px;
  102. padding: 7px 7px;
  103. }
  104. #chat_input {
  105. max-width: 99.45%;
  106. height: 50px;
  107. -webkit-transition: all 0.5s;
  108. }
  109. textarea, input, select, .input {
  110. border: 1px solid #CBCBCB;
  111. padding: 4px 3px;
  112. }
  113. .nohover input[type="submit"]:hover{
  114. background-color: #09f;
  115. color: #fff;
  116. }
  117. input[type="submit"], button {
  118. background-color: #09f;
  119. color: #fff;
  120. padding: 5px 12px;
  121. border: 1px solid #07f;
  122. font-weight: bold;
  123. margin: 0px;
  124. max-width: 100%;
  125. -webkit-appearance: none;
  126. overflow: visible;
  127. text-align: center;
  128. vertical-align: top;
  129. white-space: nowrap;
  130. border-radius: 2px;
  131. -webkit-border-radius: 2px;
  132. }
  133. </style>


Ô 2:

TWIG
  1. <div class="menu">{{nick}}: {{message}}</div>{%if "now"|date('U')-message_date|date('U')<=3 and api.user_id!=nick|slice(27,8)%}<span id="new_post"></span>{%endif%}


- Làm theo vào không cần hỏi nhiều.

DMCA.com Protection Status
Cùng Chuyên Mục
Xem thêm
Comment
Tên bạn
Nội dung


Bình luận rỗng.

Close

ảnh cm Contact Facebook
ảnh cm Contact Google+
ảnh cm Blog Trương Minh Đức
Facebook Google+ YouTube
Được tài trợ bởi