Revert "fix indentation"

This reverts commit 68bc0767f2.
This commit is contained in:
Maximilian Salomon 2023-04-17 16:34:39 +02:00
parent 75669e8805
commit 86049fc71f

View file

@ -16,16 +16,16 @@
for (var i = 0; i < flux_list.length; i++) {
if ("readingTime" in flux_list[i].dataset) {
continue;
}
if ("readingTime" in flux_list[i].dataset) {
continue;
}
reading_time.flux = flux_list[i];
reading_time.flux = flux_list[i];
reading_time.words_count = reading_time.flux_words_count(flux_list[i]); // count the words
reading_time.reading_time = reading_time.calc_read_time(reading_time.words_count, 300); // change this number (in words) to your prefered reading speed
reading_time.words_count = reading_time.flux_words_count(flux_list[i]); // count the words
reading_time.reading_time = reading_time.calc_read_time(reading_time.words_count, 300); // change this number (in words) to your prefered reading speed
flux_list[i].dataset.readingTime = reading_time.reading_time;
flux_list[i].dataset.readingTime = reading_time.reading_time;
const li = document.createElement("li");
li.setAttribute("class", "item date");
@ -43,20 +43,20 @@
flux_words_count: function flux_words_count(flux) {
reading_time.textContent = flux.querySelector('.flux_content .content').textContent; // get textContent, from the article itself (not the header, not the bottom line).
reading_time.textContent = flux.querySelector('.flux_content .content').textContent; // get textContent, from the article itself (not the header, not the bottom line).
// 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
reading_time.textContent = reading_time.textContent.replace(/[ ]{2,}/gi," ");//2 or more space to 1
reading_time.textContent = reading_time.textContent.replace(/\n /,"\n"); // exclude newline with a start spacing
// 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
reading_time.textContent = reading_time.textContent.replace(/[ ]{2,}/gi," ");//2 or more space to 1
reading_time.textContent = reading_time.textContent.replace(/\n /,"\n"); // exclude newline with a start spacing
return reading_time.textContent.split(' ').length;
return reading_time.textContent.split(' ').length;
},
calc_read_time : function calc_read_time(wd_count, speed) {
reading_time.read_time = Math.round(wd_count/speed);
if (reading_time.read_time === 0) { reading_time.read_time = '<1'; }
return reading_time.read_time;
reading_time.read_time = Math.round(wd_count/speed);
if (reading_time.read_time === 0) { reading_time.read_time = '<1'; }
return reading_time.read_time;
},
};