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 + '
';