diff --git a/js/interface_common.js b/js/interface_common.js index 7297ffb..e9f9989 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -286,7 +286,7 @@ function confirmPopup(req) { if (req.txtMessage) { if (req.txtMessage.polyglot) req.txtMessage = polyglot.t(req.txtMessage.polyglot, req.txtMessage.polyglotReq); - modal.content.find('.message').html(htmlFormatMsg(req.txtMessage, {markout: 'apply'}).html); + fillElemWithTxt(modal.content.find('.message'), req.txtMessage, {markout: 'apply'}); } var btn = modal.content.find('.confirm'); @@ -750,7 +750,7 @@ function addToCommonDMsList(list, targetAlias, message) { item.find('.post-info-tag').text('@' + targetAlias); item.find('.post-info-name').attr('href', $.MAL.userUrl(targetAlias)); - item.find('.post-text').html(htmlFormatMsg(message.text).html); + fillElemWithTxt(item.find('.post-text'), message.text); item.find('.post-info-time') .attr('title', timeSincePost(message.time)) .find('span:last') @@ -1111,8 +1111,8 @@ function clickFollow(event) { var content = $('#following-config-modal-template').children().clone(true); content.closest('.following-config-modal-content').attr('data-screen-name', peerAlias); - content.find('.following-config-method-message') - .html(htmlFormatMsg(polyglot.t('select_way_to_follow_@', {alias: peerAlias}), {markout: 'apply'}).html); + fillElemWithTxt(content.find('.following-config-method-message'), + polyglot.t('select_way_to_follow_@', {alias: peerAlias}), {markout: 'apply'}); content.find('.following-screen-name b').text(peerAlias); openModal({ @@ -1329,7 +1329,7 @@ function posPostPreview(event) { - postPreview.css('padding-left') - postPreview.css('padding-right')); } if (textArea[0].value.length) - postPreview.html(htmlFormatMsg(textArea[0].value).html).show(); + fillElemWithTxt(postPreview.show(), textArea[0].value); else postPreview.hide(); textArea.before(postPreview); @@ -1441,7 +1441,7 @@ function replyTextInput(event) { if ($.Options.postPreview.val) { if (textArea[0].value.length) - textAreaForm.find('#post-preview').html(htmlFormatMsg(textArea[0].value).html).show(); + fillElemWithTxt(textAreaForm.find('#post-preview').show(), textArea[0].value); else textAreaForm.find('#post-preview').html('').slideUp('fast'); } diff --git a/js/options.js b/js/options.js index bebcc84..8315252 100644 --- a/js/options.js +++ b/js/options.js @@ -378,8 +378,8 @@ function tickOptionsPostPreview() { var elem = $('#opt-mod-posts-display #post-preview'); var imgPreviewCont = elem.find('.preview-container'); - elem.children().first().html(htmlFormatMsg( - polyglot.t('post_preview_dummy', {logo: '/img/twister_mini.png', site: 'http://twister.net.co'})).html); + fillElemWithTxt(elem.children().first(), + polyglot.t('post_preview_dummy', {logo: '/img/twister_mini.png', site: 'http://twister.net.co'})); if ($.Options.displayPreview.val === 'enable') { imgPreviewCont.empty(); diff --git a/js/twister_formatpost.js b/js/twister_formatpost.js index 62559de..fe59b91 100644 --- a/js/twister_formatpost.js +++ b/js/twister_formatpost.js @@ -120,8 +120,7 @@ function postToElem(post, kind, promoted) { setPostCommon(elem, username, time); - msg = htmlFormatMsg(msg); - elem.find('.post-text').html(msg.html); + msg = fillElemWithTxt(elem.find('.post-text'), msg); // fillElemWithTxt() returns result of htmlFormatMsg(msg) postData.attr('data-text-mentions', msg.mentions.join()); // FIXME no idea why do we need this attribute since we don't use it but use data-reply-to instead if (username !== defaultScreenName) { @@ -232,7 +231,7 @@ function setPostReference(elem, rt, sig_rt) { .attr('data-screen-name', rt.n) .attr('data-id', rt.k) .attr('data-userpost', $.toJSON({userpost: rt, sig_userpost: sig_rt})) - .find('.post-text').html(htmlFormatMsg(rt.msg).html) + .find('.post-text').each(function (i, elem) {fillElemWithTxt($(elem), rt.msg);}) ; setPostCommon(elem, rt.n, rt.time); } @@ -274,7 +273,7 @@ function postToElemDM(dmData, localUser, remoteUser) { .text(timeGmtToText(dmData.time)) ; setPostInfoSent(senderAlias, dmData.k, elem.find('.post-info-sent')); - elem.find('.post-text').html(htmlFormatMsg(dmData.text).html); + fillElemWithTxt(elem.find('.post-text'), dmData.text); return elem; } diff --git a/js/twister_io.js b/js/twister_io.js index c2ff9b3..adbe1b3 100644 --- a/js/twister_io.js +++ b/js/twister_io.js @@ -257,11 +257,7 @@ function getFullname(peerAlias, elem) { // get bio, format it as post message and store result to elem function getBioToElem(peerAlias, elem) { - getProfileResource(peerAlias, 'bio', undefined, - function (req, ret) { - req.elem.html(htmlFormatMsg(ret).html); - }, {elem: elem} - ); + getProfileResource(peerAlias, 'bio', undefined, fillElemWithTxt, elem); } // get tox address and store it in item.text