chat.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. function message() {
  2. var a = $.blinkTitle.show();
  3. setTimeout(function() {
  4. $.blinkTitle.clear(a)
  5. },
  6. 8e3)
  7. }
  8. $(document).ready(function() {
  9. function e() {
  10. function h() { - 1 != g.indexOf("*#emo_") && (g = g.replace("*#", "<img src='img/").replace("#*", ".gif'/>"), h())
  11. }
  12. var e = new Date,
  13. f = "";
  14. f += e.getFullYear() + "-",
  15. f += e.getMonth() + 1 + "-",
  16. f += e.getDate() + " ",
  17. f += e.getHours() + ":",
  18. f += e.getMinutes() + ":",
  19. f += e.getSeconds();
  20. var g = $("#textarea").val();
  21. h();
  22. var i = "<div class='message clearfix'><div class='user-logo'><img src='" + b + "'/>" + "</div>" + "<div class='wrap-text'>" + "<h5 class='clearfix'>\u5f20\u98de</h5>" + "<div>" + g + "</div>" + "</div>" + "<div class='wrap-ri'>" + "<div clsss='clearfix'><span>" + f + "</span></div>" + "</div>" + "<div style='clear:both;'></div>" + "</div>" + "<div class='message clearfix'>" + "<div class='user-logo'>" + "<img src='" + c + "'/>" + "</div>" + "<div class='wrap-text'>" + "<h5 class='clearfix'>" + d + "</h5>" + "<div>" + g + "\u7684\u56de\u590d\u5185\u5bb9</div>" + "</div>" + "<div class='wrap-ri'>" + "<div clsss='clearfix'><span>" + f + "</span></div>" + "</div>" + "<div style='clear:both;'></div>";
  23. null != g && "" != g ? ($(".mes" + a).append(i), $(".chat01_content").scrollTop($(".mes" + a).height()), $("#textarea").val(""), message()) : alert("\u8bf7\u8f93\u5165\u804a\u5929\u5185\u5bb9!")
  24. }
  25. var a = 3,
  26. b = "img/head/2024.jpg",
  27. c = "img/head/2015.jpg",
  28. d = "\u738b\u65ed";
  29. $(".close_btn").click(function() {
  30. $(".chatBox").hide()
  31. }),
  32. $(".chat03_content li").mouseover(function() {
  33. $(this).addClass("hover").siblings().removeClass("hover")
  34. }).mouseout(function() {
  35. $(this).removeClass("hover").siblings().removeClass("hover")
  36. }),
  37. $(".chat03_content li").dblclick(function() {
  38. var b = $(this).index() + 1;
  39. a = b,
  40. c = "img/head/20" + (12 + a) + ".jpg",
  41. d = $(this).find(".chat03_name").text(),
  42. $(".chat01_content").scrollTop(0),
  43. $(this).addClass("choosed").siblings().removeClass("choosed"),
  44. $(".talkTo a").text($(this).children(".chat03_name").text()),
  45. $(".mes" + b).show().siblings().hide()
  46. }),
  47. $(".ctb01").mouseover(function() {
  48. $(".wl_faces_box").show()
  49. }).mouseout(function() {
  50. $(".wl_faces_box").hide()
  51. }),
  52. $(".wl_faces_box").mouseover(function() {
  53. $(".wl_faces_box").show()
  54. }).mouseout(function() {
  55. $(".wl_faces_box").hide()
  56. }),
  57. $(".wl_faces_close").click(function() {
  58. $(".wl_faces_box").hide()
  59. }),
  60. $(".wl_faces_main img").click(function() {
  61. var a = $(this).attr("src");
  62. $("#textarea").val($("#textarea").val() + "*#" + a.substr(a.indexOf("img/") + 4, 6) + "#*"),
  63. $("#textarea").focusEnd(),
  64. $(".wl_faces_box").hide()
  65. }),
  66. $(".chat02_bar img").click(function() {
  67. e()
  68. }),
  69. document.onkeydown = function(a) {
  70. var b = document.all ? window.event: a;
  71. return 13 == b.keyCode ? (e(), !1) : void 0
  72. },
  73. $.fn.setCursorPosition = function(a) {
  74. return 0 == this.lengh ? this: $(this).setSelection(a, a)
  75. },
  76. $.fn.setSelection = function(a, b) {
  77. if (0 == this.lengh) return this;
  78. if (input = this[0], input.createTextRange) {
  79. var c = input.createTextRange();
  80. c.collapse(!0),
  81. c.moveEnd("character", b),
  82. c.moveStart("character", a),
  83. c.select()
  84. } else input.setSelectionRange && (input.focus(), input.setSelectionRange(a, b));
  85. return this
  86. },
  87. $.fn.focusEnd = function() {
  88. this.setCursorPosition(this.val().length)
  89. }
  90. }),
  91. function(a) {
  92. a.extend({
  93. blinkTitle: {
  94. show: function() {
  95. var a = 0,
  96. b = document.title;
  97. if ( - 1 == document.title.indexOf("\u3010")) var c = setInterval(function() {
  98. a++,
  99. 3 == a && (a = 1),
  100. 1 == a && (document.title = "\u3010\u3000\u3000\u3000\u3011" + b),
  101. 2 == a && (document.title = "\u3010\u65b0\u6d88\u606f\u3011" + b)
  102. },
  103. 500);
  104. return [c, b]
  105. },
  106. clear: function(a) {
  107. a && (clearInterval(a[0]), document.title = a[1])
  108. }
  109. }
  110. })
  111. } (jQuery);