Giter VIP home page Giter VIP logo

reading-time's Issues

Not displaying on certain pages

Hi,

I am getting this error in console on some pages and this causes no reading time value in the eta div. Also, the scripts that are supposed to execute after reading time is invoked, they won't load most of the time and break the page layout. On simples pages it just works fine. Any clue, what is this error about?

image

-Amit

"each" method doesn't work with laravel foreach

I tried to use it with laravel in foreach, i want it to be displayed on every post, but it take only the last post in foreach loop and add the time & word-count to all other posts,
foreach
<div class="hidden" id="articleDesc">{{ $relatedPost->description }}</div>
<span class="eta"></span>
<span class="word-count"></span>
endforeach
$(function() {
$('#articleDesc').each(function() {
$(this).readingTime({
readingTimeTarget: '.eta',
wordCountTarget: '.word-count',
});
});
});

Problem if "wordCountTarget" is not in the selected tag.

`Hi,

Example :

<article>
        <p id="estimated-reading-time"><span class="reading-time"></span> (<span class="word-count"></span> words)</p>
    <p>Earlier this year</p>
    <p>Earlier this year</p>
    <p>Earlier this year</p>
</article>

The result is 9.

But...

<p id="estimated-reading-time"><span class="reading-time"></span> (<span class="word-count"></span> words)</p>

<article>
    <p>Earlier this year</p>
    <p>Earlier this year</p>
    <p>Earlier this year</p>
</article>

The result is 7. Also in this case, the white spaces are considered as words and readingTimeTarget does not work.

I use a CMS and it's easier if wordCountTarget is not necessarily in the selected tag... Is this can be changed ?

IE11 Problem

Message: Object doesn't support this property or method

Problem: wrong single quote character being used.

Fix
`
should be
'

Reading time for chinese language alwas show "less than a minute"

I am building multilingual website. The website has 3 languages, there are English, Bahasa Indonesia, and Chinese. The plugin seems working fine with English and Bahasa Indonesia language setting, but when using Chinese language setting it always show "less than a minute". Any idea how to fix this?

ReadingTimeTarget selector

This plugin assumes the reading time target is a descendant of the initialization element. Which is not the always case.

Example: I have my reading time target in the header of my page, while the actual article is in the main section of my page. With these settings it's impossible to use this plugin.

Translation

Can we have the texts ("Less than a minute", "Min") in the default setting so they can be easily translated ? Or another solution ?

Thx

Languages like Chinese, Japanese, Vietnamese are not separated by blanks

The current implementation depends on counting the length of the array after separating texts by white spaces. While this will work for most Indo-European languages, text in some other languages, notably Chinese and Japanese, would fail to be counted.

Concretely, the world count for 你好,世界 is expected to be 5 (or 4 if the comma is ignored), but the current code returns 1.

Is it possible to add one more option for the user to specify whether to split or not before counting?

Looping through multiple remote articles?

Hello,

Is there a method you'd recommend for including multiple read estimates for multiple remote articles in a blog list? My skills in this area are shaky so I appreciate your input.

Thanks in advance,
LB

Only works with article

If I try to use it on any other part besides the article, it doesn't work. For example, my markup looks sorta like this:

HTML:

<article class="article">
    <div class="post-header" />
    <div class="post-body" />
    <div class="post-footer" />
</article>

JQUERY

    $('.post-body').each(function() {
            let _this = $(this);
            _this.readingTime({
              readingTimeTarget: _this.find('.read-time'),
              wordCountTarget: _this.find('.word-count')
            });
          })

This doesn't work, but if I use $('.article'), then it does.

Bug: Target for remote files

There appears to be a bug with remote targets for multiple file references:

If the target is wrapped in any divs whatsoever inside the remote file, the script is unable to extract the read time estimate properly and outputs "Less than a minute (1 word)".

Thanks

Not working on IE

I just want to note that the new plugin version is not working on IE because template literals are not supported on IE:

readingTime = ${readingTimeMinutes}:${readingTimeSeconds};

Support Chinese

use the regular expression of JavaScript to process the text

1.count the number of Chinese characters;
2.replace the Chinese and special characters with space;
3.split text by spaces to define total words.

Bower

Hey, it would be great if this plugin would be available through Bower. If you're familiar with it, please create a bower.json and publish it.

Thanks :)

readingTimeTarget anywhere

I ran into two issues while using this otherwise awesome plugin:

First, it looks like we are unable to target a class anywhere we want in the page with readingTimeTarget. It has to be within the targeted article. This has serious limitations if we have a specific design and while we can move the span around on success via jquery, it is not ideal.

Second, it would be nice to have an option to return only the number of minutes, without "min" appended to it. Better yet, two append options (singular/plural), but it may overcomplicate...

IE8 Problem

Hi, i get this error on console on I8. Is it possible to make this plugin compatible with IE8 ?

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
Timestamp: Fri, 4 Jul 2014 19:14:57 UTC

Message: Object doesn't support this property or method
Line: 12
Char: 999
Code: 0
URI: http://michael-lynch.github.io/reading-time/js/readingTime.min.js

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.