From 17b72746655bb2429b0557ad9fe404a389787915 Mon Sep 17 00:00:00 2001 From: Nokita Kaze Date: Tue, 30 Dec 2014 17:57:43 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A3=20=D0=BC=D0=B5=D0=BD=D1=8F=20=D1=81?= =?UTF-8?q?=D0=B5=D0=B9=D1=87=D0=B0=D1=81=20=D0=BE=D1=89=D1=83=D1=89=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=B0=D0=BA=20=D1=83=20=D0=B3=D0=BB?= =?UTF-8?q?=D0=B0=D0=B2=D0=BD=D0=BE=D0=B3=D0=BE=20=D0=B3=D0=B5=D1=80=D0=BE?= =?UTF-8?q?=D1=8F=20=D0=BF=D0=B5=D1=80=D0=B2=D0=BE=D0=B9=20=D1=81=D0=B5?= =?UTF-8?q?=D1=80=D0=B8=D0=B8=20=D0=BF=D0=B5=D1=80=D0=B2=D0=BE=D0=B3=D0=BE?= =?UTF-8?q?=20=D1=81=D0=B5=D0=B7=D0=BE=D0=BD=D0=B0=20Black=20Mirror=20?= =?UTF-8?q?=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20=D1=82=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=BA=D0=B0=D0=BA=20=D0=BE=D0=BD=20=D1=81=D0=B4=D0=B5=D0=BB?= =?UTF-8?q?=D0=B0=D0=BB=20=D1=82=D0=BE,=20=D1=87=D1=82=D0=BE=20=D0=B5?= =?UTF-8?q?=D0=B3=D0=BE=20=D0=B7=D0=B0=D1=81=D1=82=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D0=B8=20=D1=81=D0=B4=D0=B5=D0=BB=D0=B0=D1=82=D1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chrome_point_plus/js/point-plus.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/chrome_point_plus/js/point-plus.js b/chrome_point_plus/js/point-plus.js index 571ac8c..7da6c05 100644 --- a/chrome_point_plus/js/point-plus.js +++ b/chrome_point_plus/js/point-plus.js @@ -1105,7 +1105,8 @@ function hints_draw_main_user_hint(items) { current_text = items[current_user_name]; } var text_block = document.createElement('div'); - $(text_block).addClass('text').html(hints_raw_text_to_html(current_text)); + $(text_block).addClass('text'); + safe_saned_text(current_text, $(text_block)); current_user_hint_block.appendChild(text_block); // Рисуем невидимый блок для управления @@ -1116,7 +1117,7 @@ function hints_draw_main_user_hint(items) { $(change_hint_block).find('.button_save').on('click', function() { $('.current-user-hint .change_hint_block').slideUp(500); var new_text = $('.current-user-hint .change_hint_block textarea').val(); - $('.current-user-hint > .text').hide().html(hints_raw_text_to_html(new_text)).fadeIn(750); + safe_saned_text(new_text, $('.current-user-hint > .text').hide().fadeIn(750)); hints_save_new_hint(current_user_name, new_text); }); $(change_hint_block).find('.button_cancel').on('click', function() { @@ -1125,16 +1126,15 @@ function hints_draw_main_user_hint(items) { current_user_hint_block.appendChild(change_hint_block); } -// Превращаем сырой текст в нормальный, обёрнутый в p -function hints_raw_text_to_html(text) { - text = text - .replace('&', "&") - .replace('<', "<") - .replace('>', ">") - .replace('"', """) - .replace("'", "'") - .replace(/\r?\n/g, "

") - return '

' + text + '

'; +// Nokita Kaze снимает с себя все претензии по этому коду, обращайтесь к фаундеру проекта +function safe_saned_text(text, object) { + var n = text.split(/\r?\n/); + object.text(''); + for (var i = 0; i < n.length; i++) { + var d = document.createElement('p'); + $(d).text(n[i]); + object[0].appendChild(d); + } } // Рисуем title'ы на всех доступных пользователях, точнее на их аватарках