|
|
|
@ -1,7 +1,7 @@
|
|
|
|
|
// ==UserScript==
|
|
|
|
|
// @name News parser
|
|
|
|
|
// @namespace http://zakonvremeni.ru
|
|
|
|
|
// @version 0.3.1
|
|
|
|
|
// @version 0.3.2
|
|
|
|
|
// @description Parse news
|
|
|
|
|
// @author AlexeiBv+mirocod@narod.ru
|
|
|
|
|
// @match https://tass.ru/*
|
|
|
|
@ -110,6 +110,9 @@
|
|
|
|
|
img_src = c.src; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (img_src.length > 0) { |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (img_src.length > 0) { |
|
|
|
|
return '<p style = "text-align:' + a_TextAlign + ';"><img src = "'+ img_src + '" width = "600px"/></p>'; |
|
|
|
@ -207,6 +210,10 @@
|
|
|
|
|
parent.removeChild(a_Element); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function RemoveCommentsHTML(a_String){ |
|
|
|
|
return ( a_String || '' ).replace( /(<!--.*?-->)|(<!--[\S\s]+?-->)|(<!--[\S\s]*?$)/g, '' ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
function GetClearHtml(a_Element, a_OutTag, a_TextAlign, a_SubElementCheckerToRemove, a_ClearTextFunc, a_ElementIndex) { |
|
|
|
|
let clear_element = a_Element.cloneNode(true); |
|
|
|
|
|
|
|
|
@ -250,7 +257,7 @@
|
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
let result = TrimString(clear_element.innerHTML); |
|
|
|
|
let result = TrimString(RemoveCommentsHTML(clear_element.innerHTML)); |
|
|
|
|
if (a_ClearTextFunc) { |
|
|
|
|
result = a_ClearTextFunc(result, a_ElementIndex); |
|
|
|
|
} |
|
|
|
|