Improve content detection

This commit is contained in:
lapineige 2019-10-21 22:41:41 +02:00 committed by Marien Fressinaud
parent 9777c87192
commit 64e85099ad

View file

@ -42,7 +42,7 @@
flux_words_count: function flux_words_count(flux) {
reading_time.textContent = flux.childNodes[2].childNodes[1].textContent; // get textContent, from the article itself (not the header, not the bottom line). `childNodes[2].childNodes[1]` gives : `<div class="content no_limit">` element
reading_time.textContent = flux.querySelector('.flux_content').textContent; // get textContent, from the article itself (not the header, not the bottom line). `childNodes[2].childNodes[1]` gives : `<div class="content no_limit">` element
// split the text to count the words correctly (source: http://www.mediacollege.com/internet/javascript/text/count-words.html)
reading_time.textContent = reading_time.textContent.replace(/(^\s*)|(\s*$)/gi,"");//exclude start and end white-space