From e68ad3e294cd5efe34d6d38861e56573a90c318a Mon Sep 17 00:00:00 2001 From: Alexei Bezborodov Date: Mon, 30 Oct 2023 11:25:39 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=A0=D0=98=D0=90=20=D0=B8=20=D0=A2?= =?UTF-8?q?=D0=90=D0=A1=D0=A1=20#9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- news_parser.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/news_parser.js b/news_parser.js index 5c95ffa..69d2b3f 100644 --- a/news_parser.js +++ b/news_parser.js @@ -151,7 +151,7 @@ } function ElementCheckerRia(a_Element) { - if (a_Element.dataset.type == 'article' || a_Element.dataset.type == 'banner' || a_Element.dataset.type == 'media') { + if (a_Element.dataset.type == 'article' || a_Element.dataset.type == 'banner' || a_Element.dataset.type == 'media' || a_Element.dataset.type == 'video') { return false; } @@ -206,7 +206,7 @@ parent.removeChild(a_Element); } - function GetClearHtml(a_Element, a_OutTag, a_TextAlign, a_SubElementCheckerToRemove) { + function GetClearHtml(a_Element, a_OutTag, a_TextAlign, a_SubElementCheckerToRemove, a_ClearTextFunc, a_ElementIndex) { let clear_element = a_Element.cloneNode(true); let elements = clear_element.querySelectorAll('*'); @@ -250,6 +250,9 @@ }); let result = TrimString(clear_element.innerHTML); + if (a_ClearTextFunc) { + result = a_ClearTextFunc(result, a_ElementIndex); + } if (a_OutTag && a_TextAlign && TrimString(result).replace(' ', '') != '') { result = '<' + a_OutTag + ' style = "text-align:' + a_TextAlign + ';">' + result + ''; } @@ -263,10 +266,7 @@ if (a_Element && CheckRegExp(GetElementClassName, 'Title_title.*', a_Element)) { out_tag = 'h2'; } - let a_Content = GetClearHtml(a_Element, out_tag, a_TextAlign, a_SubElementCheckerToRemove) - if (a_ClearTextFunc) { - a_Content = a_ClearTextFunc(a_Content, a_ElementIndex); - } + let a_Content = GetClearHtml(a_Element, out_tag, a_TextAlign, a_SubElementCheckerToRemove, a_ClearTextFunc, a_ElementIndex); if (a_Element && a_Element.dataset && a_Element.dataset.type == 'quote') { a_Content = '
' + a_Content + '
';