app/assets/javascripts/chatroom/messages.js.coffee in chatroom-0.0.9 vs app/assets/javascripts/chatroom/messages.js.coffee in chatroom-0.1.0
- old
+ new
@@ -9,10 +9,13 @@
$("#chatBeam").show()
false
maxChatroom: () ->
$("#chatBeam").hide()
+ flash = $("#chatBeam .max-chatroom").attr("interval")
+ $("#chatBeam .max-chatroom").attr("interval", null)
+ clearInterval(flash)
$("#chatroom").slideToggle()
false
# Editor: change the text in textarea
changeSelectionChar: (elemTag) ->
@@ -41,21 +44,36 @@
false
# Editor: show all the emotions for selecting
constructEmotions: () ->
table = $("table.chatroom-emotions-images tbody")
+ page = $("<div><span class='emotions-page' style='float: left;'><</span><span class='emotions-page' style='float:right;'>></span></div>")
if !table.has("span").length
- for i in [0...5]
- row = $("<tr></tr>")
+ for i in [0...10]
+ if i < 5
+ row = $("<tr></tr>")
+ else
+ row = $("<tr style='display:none;'></tr>")
for j in [0...8]
n = i * 8 + j
img = $("<span></span>").addClass("emotion-img")
img.attr("emotion", "#{n}")
img.css({"background": "url(\"/assets/emotions/#{n}.gif\")"})
img.click(Messages.selectEmotion)
cell = $("<td></td>").addClass("chat-cell").append(img)
row.append(cell)
table.append(row)
+ table.append(page)
+ Messages.emotionsPageTurning()
+ false
+
+ emotionsPageTurning: () ->
+ $("span.emotions-page").click ->
+ if $(this).html() == "<"
+ $("table.chatroom-emotions-images tbody tr").toggle()
+ else if $(this).html() == ">"
+ $("table.chatroom-emotions-images tbody tr").toggle()
+ false
false
displayAllEmotions: () ->
Messages.constructEmotions()
$("table.chatroom-emotions-images").toggle()