support-chat/js/supportchat.js

changeset 54
e5e70a46ace8
parent 53
5cb47f4087a8
child 55
6f0822a428b7
equal deleted inserted replaced
53:5cb47f4087a8 54:e5e70a46ace8
61 if(ui_state != new_state) 61 if(ui_state != new_state)
62 { 62 {
63 $("#support-"+ui_state).hide(); 63 $("#support-"+ui_state).hide();
64 $("#support-"+(ui_state=new_state)).show(); 64 $("#support-"+(ui_state=new_state)).show();
65 } 65 }
66 }
67
68 var current_assistant = null;
69 function set_assistant(new_assistant)
70 {
71 if(new_assistant == null)
72 {
73 $("#support-assistant-name").text("No assistant present.");
74 question_muc.send_message("{System} There is now no active assistant");
75 team_muc.send_message("Query has no active assistant");
76 show_message(null, current_assistant + " has left, please stand by.");
77 }
78 else
79 {
80 $("#support-assistant-name").html("<u>Assistant:</u> "+htmlescape(new_assistant));
81 question_muc.send_message("{System} "+new_assistant+": You are now the selected assistant");
82 team_muc.send_message("Query being handled by "+new_assistant);
83 show_message(null, "You are now being assisted by " + new_assistant)
84 }
85 current_assistant = new_assistant;
86 }
87
88 function show_message(nick, message)
89 {
90 var html = "<span class='muc-"+(nick?"message":"system")+"'>";
91 if(nick)
92 html += "<span class='muc-nick'>" + htmlescape(nick) + "</span>" + ": ";
93 html += htmlescape(message) + "</span><br/>\n";
94 $("#support-log").append(html).scrollTop($("#support-log")[0].scrollHeight);
66 } 95 }
67 96
68 /* Handle the user submitting the question form */ 97 /* Handle the user submitting the question form */
69 function on_question_submit() 98 function on_question_submit()
70 { 99 {

mercurial