File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -43,23 +43,28 @@ function findLargestElement(e) {
43
43
}
44
44
45
45
export function getCoreContentText ( ) {
46
+ function getTextFrom ( e ) {
47
+ return e . innerText || e . textContent
48
+ }
49
+
46
50
for ( const [ siteName , selectors ] of Object . entries ( adapters ) ) {
47
51
if ( location . hostname . includes ( siteName ) ) {
48
52
const element = getPossibleElementByQuerySelector ( selectors )
49
- if ( element ) return element . innerText || element . textContent
53
+ if ( element ) return getTextFrom ( element )
50
54
break
51
55
}
52
56
}
53
57
58
+ const element = document . querySelector ( 'article' )
59
+ if ( element ) {
60
+ return getTextFrom ( element )
61
+ }
62
+
54
63
const largestElement = findLargestElement ( document . body )
55
64
const secondLargestElement = findLargestElement ( largestElement )
56
65
console . log ( largestElement )
57
66
console . log ( secondLargestElement )
58
67
59
- function getTextFrom ( e ) {
60
- return e . innerText || e . textContent
61
- }
62
-
63
68
let ret
64
69
if ( ! largestElement ) {
65
70
ret = getTextFrom ( document . body )
You can’t perform that action at this time.
0 commit comments