Mercurial > xmpp-account-manager
comparison client.js @ 57:427807059ca8
Use `` in JS for templating, and add two forgotten strings.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Sun, 24 May 2020 12:51:07 +0200 |
parents | 010b905a74d4 |
children | 6d861d881b96 |
comparison
equal
deleted
inserted
replaced
56:010b905a74d4 | 57:427807059ca8 |
---|---|
96 | 96 |
97 function onConnect(status) | 97 function onConnect(status) |
98 { | 98 { |
99 if (status == Strophe.Status.CONNECTING) { | 99 if (status == Strophe.Status.CONNECTING) { |
100 console.log('Strophe is connecting.'); | 100 console.log('Strophe is connecting.'); |
101 connect_button.value = 'Log out'; | 101 connect_button.value = `{% trans 'Log out' %}`; |
102 connect_button.classList.add('disconnect'); | 102 connect_button.classList.add('disconnect'); |
103 jid_element.disabled = true; | 103 jid_element.disabled = true; |
104 pass_element.disabled = true; | 104 pass_element.disabled = true; |
105 displaySpinner(spinner_img); | 105 displaySpinner(spinner_img); |
106 } else if (status == Strophe.Status.CONNFAIL) { | 106 } else if (status == Strophe.Status.CONNFAIL) { |
120 | 120 |
121 function onConnected() | 121 function onConnected() |
122 { | 122 { |
123 const new_node = document.createElementNS('http://www.w3.org/1999/xhtml', 'span'); | 123 const new_node = document.createElementNS('http://www.w3.org/1999/xhtml', 'span'); |
124 const parent_node = connect.parentNode; | 124 const parent_node = connect.parentNode; |
125 const text = document.createTextNode('{% trans 'Logged in as {} ' %}'.replace('{}', connection.authzid)); | 125 const text = document.createTextNode(`{% trans 'Logged in as ${connection.authzid} ' %}`); |
126 new_node.appendChild(text); | 126 new_node.appendChild(text); |
127 parent_node.insertBefore(new_node, connect); | 127 parent_node.insertBefore(new_node, connect); |
128 | 128 |
129 jid_element.hidden = true; | 129 jid_element.hidden = true; |
130 pass_element.hidden = true; | 130 pass_element.hidden = true; |
138 initMAM(connection); | 138 initMAM(connection); |
139 } | 139 } |
140 | 140 |
141 function onDisconnected() | 141 function onDisconnected() |
142 { | 142 { |
143 connect_button.value = 'Log in'; | 143 connect_button.value = `{% trans 'Log in' %}`; |
144 connect_button.classList.remove('disconnect'); | 144 connect_button.classList.remove('disconnect'); |
145 jid_element.hidden = false; | 145 jid_element.hidden = false; |
146 jid_element.disabled = false; | 146 jid_element.disabled = false; |
147 pass_element.hidden = false; | 147 pass_element.hidden = false; |
148 pass_element.disabled = false; | 148 pass_element.disabled = false; |