From 86049fc71ff5ceb79c0fc6bf5aa320a8016f5048 Mon Sep 17 00:00:00 2001 From: Maximilian Salomon Date: Mon, 17 Apr 2023 16:34:39 +0200 Subject: [PATCH] Revert "fix indentation" This reverts commit 68bc0767f28b49cb83138f0d1006d4d2c4dab829. --- xExtension-ReadingTime/static/readingtime.js | 32 ++++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/xExtension-ReadingTime/static/readingtime.js b/xExtension-ReadingTime/static/readingtime.js index eeb6aee..0a9be9b 100644 --- a/xExtension-ReadingTime/static/readingtime.js +++ b/xExtension-ReadingTime/static/readingtime.js @@ -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; }, };