Mon, 22 Mar 2010 11:42:42 +0000
Add support for sending messages from the converse UI
12
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
1 | /* Config */ |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
2 | |
16
ebc14a22a0c1
Switch to using a table of config options (will allow for easier configuration later)
Matthew Wild <mwild1@gmail.com>
parents:
15
diff
changeset
|
3 | var support_config = { |
ebc14a22a0c1
Switch to using a table of config options (will allow for easier configuration later)
Matthew Wild <mwild1@gmail.com>
parents:
15
diff
changeset
|
4 | login_domain: "anon.localhost", |
ebc14a22a0c1
Switch to using a table of config options (will allow for easier configuration later)
Matthew Wild <mwild1@gmail.com>
parents:
15
diff
changeset
|
5 | bosh_url: "/http-bind", |
21
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
6 | muc_server: "support.localhost", |
16
ebc14a22a0c1
Switch to using a table of config options (will allow for easier configuration later)
Matthew Wild <mwild1@gmail.com>
parents:
15
diff
changeset
|
7 | team_rooms: { |
ebc14a22a0c1
Switch to using a table of config options (will allow for easier configuration later)
Matthew Wild <mwild1@gmail.com>
parents:
15
diff
changeset
|
8 | "Sales": "sales@support.localhost", |
ebc14a22a0c1
Switch to using a table of config options (will allow for easier configuration later)
Matthew Wild <mwild1@gmail.com>
parents:
15
diff
changeset
|
9 | "Technical": "technical@support.localhost" |
ebc14a22a0c1
Switch to using a table of config options (will allow for easier configuration later)
Matthew Wild <mwild1@gmail.com>
parents:
15
diff
changeset
|
10 | } |
ebc14a22a0c1
Switch to using a table of config options (will allow for easier configuration later)
Matthew Wild <mwild1@gmail.com>
parents:
15
diff
changeset
|
11 | }; |
12
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
12 | |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
13 | /*** XMPP handling */ |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
14 | var conn = null; |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
15 | |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
16 | /* Called by Strophe when status of connection changes |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
17 | (from disconnected to connected, vice-versa, etc.) |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
18 | */ |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
19 | function handle_connection_status(status, err) |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
20 | { |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
21 | if(err) |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
22 | alert(err); //FIXME: Handle gracefully |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
23 | } |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
24 | |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
25 | /* Initiate the connection to the XMPP server */ |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
26 | function start_connection() |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
27 | { |
16
ebc14a22a0c1
Switch to using a table of config options (will allow for easier configuration later)
Matthew Wild <mwild1@gmail.com>
parents:
15
diff
changeset
|
28 | conn = new Strophe.Connection(support_config.bosh_url); |
12
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
29 | var ret = true; |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
30 | try |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
31 | { |
16
ebc14a22a0c1
Switch to using a table of config options (will allow for easier configuration later)
Matthew Wild <mwild1@gmail.com>
parents:
15
diff
changeset
|
32 | conn.connect(support_config.login_domain, null, handle_connection_status, 50); |
12
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
33 | } |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
34 | catch(e) |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
35 | { |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
36 | ret = false; |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
37 | } |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
38 | return ret; |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
39 | } |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
40 | |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
41 | |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
42 | /*** UI handling */ |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
43 | |
23
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
44 | var ui_state = "question"; |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
45 | function set_ui_state(new_state) |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
46 | { |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
47 | if(ui_state != new_state) |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
48 | { |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
49 | $("#support-"+ui_state).hide(); |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
50 | $("#support-"+(ui_state=new_state)).show(); |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
51 | } |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
52 | } |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
53 | |
12
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
54 | /* Handle the user submitting the question form */ |
7
53201a5347f9
Add dummy event handler for question submit
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
55 | function on_question_submit() |
53201a5347f9
Add dummy event handler for question submit
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
56 | { |
9
6677316d8834
Example question submit handler until BOSH backend integrated
Matthew Wild <mwild1@gmail.com>
parents:
7
diff
changeset
|
57 | var question_type = $("#support-question-type").val(); |
13 | 58 | var question_name = $("#support-question-name").val(); |
9
6677316d8834
Example question submit handler until BOSH backend integrated
Matthew Wild <mwild1@gmail.com>
parents:
7
diff
changeset
|
59 | var question_text = $("#support-question-text").val(); |
6677316d8834
Example question submit handler until BOSH backend integrated
Matthew Wild <mwild1@gmail.com>
parents:
7
diff
changeset
|
60 | |
21
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
61 | var our_nick = question_name; |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
62 | |
23
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
63 | set_ui_state("wait"); |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
64 | |
21
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
65 | // Create our question room |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
66 | var question_muc = new MUC(conn, { |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
67 | joined: function (stanza, muc, nick) |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
68 | { |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
69 | if(nick == our_nick) |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
70 | team_muc.join(support_config.team_rooms[question_type], our_nick); |
23
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
71 | else if(ui_state == "wait") |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
72 | { |
34
510ca613996a
Add support for sending messages from the converse UI
Matthew Wild <mwild1@gmail.com>
parents:
33
diff
changeset
|
73 | var html = "<span class='muc-message'><span class='muc-nick'>" + htmlescape(nick) + "</span>" + " is answering your query</span><br/>\n"; |
510ca613996a
Add support for sending messages from the converse UI
Matthew Wild <mwild1@gmail.com>
parents:
33
diff
changeset
|
74 | $("#support-log").append(html).scrollTop($("#support-log")[0].scrollHeight); |
510ca613996a
Add support for sending messages from the converse UI
Matthew Wild <mwild1@gmail.com>
parents:
33
diff
changeset
|
75 | $("#support-send-button").click(function () |
510ca613996a
Add support for sending messages from the converse UI
Matthew Wild <mwild1@gmail.com>
parents:
33
diff
changeset
|
76 | { |
510ca613996a
Add support for sending messages from the converse UI
Matthew Wild <mwild1@gmail.com>
parents:
33
diff
changeset
|
77 | question_muc.send_message($("#support-input").val()); |
510ca613996a
Add support for sending messages from the converse UI
Matthew Wild <mwild1@gmail.com>
parents:
33
diff
changeset
|
78 | $("#support-input").val(""); |
510ca613996a
Add support for sending messages from the converse UI
Matthew Wild <mwild1@gmail.com>
parents:
33
diff
changeset
|
79 | }); |
23
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
80 | set_ui_state("converse"); |
ee84e7c22600
New logic for controlling the current UI state
Matthew Wild <mwild1@gmail.com>
parents:
22
diff
changeset
|
81 | } |
28
85fb6653b6e0
Display incoming messages in the UI
Matthew Wild <mwild1@gmail.com>
parents:
27
diff
changeset
|
82 | }, |
85fb6653b6e0
Display incoming messages in the UI
Matthew Wild <mwild1@gmail.com>
parents:
27
diff
changeset
|
83 | |
85fb6653b6e0
Display incoming messages in the UI
Matthew Wild <mwild1@gmail.com>
parents:
27
diff
changeset
|
84 | message: function (stanza, muc, nick, message) |
85fb6653b6e0
Display incoming messages in the UI
Matthew Wild <mwild1@gmail.com>
parents:
27
diff
changeset
|
85 | { |
85fb6653b6e0
Display incoming messages in the UI
Matthew Wild <mwild1@gmail.com>
parents:
27
diff
changeset
|
86 | var html = "<span class='muc-message'><span class='muc-nick'>" + htmlescape(nick) + "</span>" + ": " + htmlescape(message) + "</span><br/>\n"; |
85fb6653b6e0
Display incoming messages in the UI
Matthew Wild <mwild1@gmail.com>
parents:
27
diff
changeset
|
87 | $("#support-log").append(html).scrollTop($("#support-log")[0].scrollHeight); |
21
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
88 | } |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
89 | }); |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
90 | |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
91 | // Get a unique room name from the server and then join the question MUC |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
92 | conn.sendIQ($iq({to: support_config.muc_server, type: "get"}) |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
93 | .c("query", { xmlns: "http://jabber.org/protocol/muc#unique" }), |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
94 | function (result) // Success |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
95 | { |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
96 | var unique = Strophe.getText(result.getElementsByTagName("unique")[0]); |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
97 | question_muc.join(unique + "@" + support_config.muc_server, our_nick); |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
98 | }, |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
99 | function (result) // Failure |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
100 | { |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
101 | //FIXME |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
102 | }); |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
103 | |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
104 | // Create the team MUC object (it will be joined after we join the question MUC) |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
105 | var team_muc = new MUC(conn, { |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
106 | joined: function (stanza, muc, nick) |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
107 | { |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
108 | if(nick != our_nick) |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
109 | return; |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
110 | |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
111 | for(var nick in team_muc.occupants) |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
112 | team_muc.send_private_message(nick, question_text + "\n" + question_muc.jid); |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
113 | }, |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
114 | |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
115 | error: function (stanza, muc, error) |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
116 | { |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
117 | if(error == "conflict") |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
118 | { |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
119 | our_nick += "_"; |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
120 | muc.join(support_config.team_rooms[question_type], our_nick); |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
121 | } |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
122 | else |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
123 | alert("unhandled error: " + error); |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
124 | } |
b691536ed125
Support for joining the question and team MUCs, and notifying team members of the question
Matthew Wild <mwild1@gmail.com>
parents:
16
diff
changeset
|
125 | }); |
7
53201a5347f9
Add dummy event handler for question submit
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
126 | } |
53201a5347f9
Add dummy event handler for question submit
Matthew Wild <mwild1@gmail.com>
parents:
4
diff
changeset
|
127 | |
3 | 128 | function display_ui() |
129 | { | |
130 | // Display pop-up, showing question form | |
12
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
131 | if(start_connection()) |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
132 | { |
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
133 | $("#support-question-submit").click(on_question_submit); |
33 | 134 | $("#support-chat").dialog({ |
135 | title:"Live Support", | |
136 | height: 400, | |
137 | width: 285 | |
138 | }); | |
12
7b0df9aad29c
Connecting to the XMPP server
Matthew Wild <mwild1@gmail.com>
parents:
9
diff
changeset
|
139 | } |
3 | 140 | } |
141 | ||
27
8ca116c827cf
Add htmlescape() helper function
Matthew Wild <mwild1@gmail.com>
parents:
26
diff
changeset
|
142 | /*** Helper functions */ |
8ca116c827cf
Add htmlescape() helper function
Matthew Wild <mwild1@gmail.com>
parents:
26
diff
changeset
|
143 | function htmlescape(s) |
8ca116c827cf
Add htmlescape() helper function
Matthew Wild <mwild1@gmail.com>
parents:
26
diff
changeset
|
144 | { |
8ca116c827cf
Add htmlescape() helper function
Matthew Wild <mwild1@gmail.com>
parents:
26
diff
changeset
|
145 | return s.replace(/&/g,'&'). |
8ca116c827cf
Add htmlescape() helper function
Matthew Wild <mwild1@gmail.com>
parents:
26
diff
changeset
|
146 | replace(/>/g,'>'). |
8ca116c827cf
Add htmlescape() helper function
Matthew Wild <mwild1@gmail.com>
parents:
26
diff
changeset
|
147 | replace(/</g,'<'). |
8ca116c827cf
Add htmlescape() helper function
Matthew Wild <mwild1@gmail.com>
parents:
26
diff
changeset
|
148 | replace(/"/g,'"'); |
8ca116c827cf
Add htmlescape() helper function
Matthew Wild <mwild1@gmail.com>
parents:
26
diff
changeset
|
149 | } |
8ca116c827cf
Add htmlescape() helper function
Matthew Wild <mwild1@gmail.com>
parents:
26
diff
changeset
|
150 | |
3 | 151 | $(display_ui); //FIXME (debugging) |