Strip code tag from Yandex reponse.

When getting a translation suggestion for a string that contains string
replacements (like %(foo)s), Yandex wraps string replacements in
annoying <code> tags, this commit strips those tags automatically.
This commit is contained in:
David Jean Louis 2018-11-15 18:03:01 +01:00
parent 710da65f04
commit 12490bae56

View file

@ -64,7 +64,7 @@ google.setOnLoadCallback(function() {
dataType: 'jsonp',
success: function(response) {
if (response.code == 200) {
trans.val(response.text[0].replace(/<br>/g, '\n').replace(/&lt;/g, '<').replace(/&gt;/g, '>'));
trans.val(response.text[0].replace(/<br>/g, '\n').replace(/<\/?code>/g, '').replace(/&lt;/g, '<').replace(/&gt;/g, '>'));
a.hide();
} else {
a.text(response);