Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-enable for certain sites #15

Closed
insanityfarm opened this issue Oct 17, 2016 · 16 comments
Closed

Auto-enable for certain sites #15

insanityfarm opened this issue Oct 17, 2016 · 16 comments

Comments

@insanityfarm
Copy link

Great extension! I'd love the ability to auto-activate Just Read on certain sites. A user-configurable list of domains in the options screen would probably be sufficient. Have you thought about implementing such a feature?

@ZachSaucier
Copy link
Owner

I've thought about some similar features using a couple different means but not exactly in this way. This way seems achievable and limited in scope, which is good. I can imagine it possibly be annoying, but it's worth exploring/testing for sure.

Some questions I have regarding user expectations of the feature (I have my own answers to this but I'm curious what you think for each):

  • How can Just Read determine that a page's content is loaded fully?
  • What happens before Just Read is ready?
  • What happens when the Just Read version is closed?

@ZachSaucier
Copy link
Owner

ZachSaucier commented Nov 7, 2016

I implemented this feature in 94144f0 / 1.0.8 but have done minimal testing thus far. You can optionally enable it on the Options page under "Auto-run domain list". To do so, just include the domains the expression (see the comment below) that you want Just Read to run on, such as the following:

nytimes.com
redandblack

Note that the current functionality is based completely off of the domain, including the "www." or not (so if a site has both www. and not, you need to include both in the list). It's possible that we may want to change the functionality to search the URL for a specific string, such as somenewswebsite.com/articles/ so that the non-article pages are not affected. and it gives more freedom. Let me know what you think.

Edit: Just Read now uses regex to parse the given list. This allows more freedom to specify specific types of pages while keeping the error rate low. For more information see the comment below.


Answering my own questions from the post above for completeness (for how it currently works):

  • I decided to run Just Read on window.onload, which will show the original page's contents but open the Just Read format as soon as the window says it's ready.
  • I decided against trying to use a different overlay to try and hide the original page contents because by the time Just Read could do that, the page would have showed for a little while anyway.
  • Since the page loads normally until it is fully loaded, at which point Just Read runs, closing it has no issue, it's the same as normal.

@insanityfarm
Copy link
Author

Fantastic follow-through, thanks very much. I'd meant to write up some responses for you but got caught up in work. Just got the notification of your update this morning... sorry for leaving you hanging.

I haven't had a chance to try out your implementation yet but the logic you describe seems reasonable. Shame about the visual flash before window.onload but I understand why you needed to do it that way. It's probably not an issue when you get used to it.

@ZachSaucier
Copy link
Owner

ZachSaucier commented Nov 8, 2016

Notice the change in functionality since posting: as of version 1.0.9 it will search the given URL vs the new page's URL to determine whether or not it should auto-run Just Read.

Let me know if I broke something, haha.

Thanks for suggesting the feature!

@ZachSaucier
Copy link
Owner

FYI I'm loving this feature, haha

@ZachSaucier
Copy link
Owner

ZachSaucier commented Nov 20, 2016

I just added another related feature in version 1.0.11 where users can open an article in Just Read form by right clicking a link to the article then clicking "View the linked page using Just Read", which will load the link in a new tab and automatically run Just Read on it (without having to add it to the domain list or navigate to the page and manually open Just Read).

I looked into creating a keyboard shortcut for this, like Ctrl + Alt + Left-click on a link, but couldn't figure out how to properly get it working.

@ZachSaucier
Copy link
Owner

ZachSaucier commented Nov 22, 2016

In order to give more control, I switched this over to use JavaScript's new RegExp(str, "i") and url.match( regex ). Thus the original functionality is retained but you can now do things like the following:

  • To search the whole URL for a given string: givenString
  • To get URLs starting with a given string: ^(givenString)
  • To get URLs ending with a given string: (givenString)$

or any other valid Regex expression. You can play around with string and expression matching here. See MDN for more information.

I am using the ignore case i flag currently because I think it's most appropriate, though I'd be open to discussing whether or not that should remain.

Side note: This list is checked automatically (the save button doesn't have to be clicked).


Edit

As of Just Read version 5.2.0, you can also append a > followed by a millisecond to delay the autorun of that pattern match by that amount. For example

text.npr.org>5000

would delay Just Read's autostart by 5 seconds for URLs that contain that string.

@ysamjo
Copy link

ysamjo commented May 9, 2017

This is brilliant and the sole reason I installed the extension.

Personally I want to use Just Read everytime I read an article.
Is there a crowdsourced Google Doc or else that collects magazine/blog URLs?

At which point the system would bog down, because of too much regex parsing?

@ZachSaucier
Copy link
Owner

ZachSaucier commented May 9, 2017

@ysamjo I'm glad you like it!

So far the answer is no, there isn't a crowdsourced list of article-type websites. But you're free to start one! If you do, make sure that the regex selects only article-type pages of given websites as much as possible, meaning probably not the home page of many websites but preferably only the article pages. I realize that isn't always possible to do.

As for bogging down your browser or Just Read, the only thing it could do it increase the amount of time it takes for Just Read to start. JavaScript is pretty fast, so the list would have to be long for it to make any noticeable affect.

With all of that being said, the reason why I don't attempt to have a running list is because it's likely to be error prone, especially given time, and many people are okay with reading articles on some webpages because the built in styling isn't horrid, whereas on specific other sites the built in styling is so bad that they really need to use Just Read.

@gouravkr
Copy link

Can you help me understand this feature a bit?
What I want to do is this:
I want to auto enable it on www.livemint.com only if the url ends with .html
However, I do not want to enable it if it is something like www.livemint.com/query/****.html i.e. there is the string query after the first /

How can I do this?

@ZachSaucier
Copy link
Owner

ZachSaucier commented Aug 29, 2017

@gouravkr It checks using regex format. I'm not very good at regex, so this could likely be improved, but this should work for you:

^(?=^http:\/\/www\.livemint\.com)(?=.*\.html$)((?!\/query\/).)*$

It checks that the start is http://www.livemint.com, makes sure .html is at the end, and then makes sure that /query/ is not in the address.

@sinhthanh
Copy link

I love selected text and deletion mode features. But can you have some kind of undo for deletion? sometimes I accidentally delete the wrong part or even the whole main text, then I have to do the deletion from the beginning.

@ZachSaucier
Copy link
Owner

ZachSaucier commented May 15, 2018

@sinhthanh Yes, that's a good suggestion. I'd likely implement undo for title/author changes as well - a more full undo functionality. I made a new issue requesting it - #156

@ysamjo
Copy link

ysamjo commented May 30, 2018

@ZachSaucier I experienced that a lot of blogs are structuring their URLs as follows:

http(s)://name.tld/year/month/day/ID/articlename
For example: https://www.theverge.com/2018/5/29/17406958/carrot-weather-malicious-ai-app-android-early-beta

Can you tell me the Regex to single out every URL that has a /20* behind the TLD?
Thanks in advance and keep up the good work.

@ZachSaucier
Copy link
Owner

ZachSaucier commented May 30, 2018

@ysamjo A (probably crappy) way to do this would be to use (?=\.*)/20, which matches with any URL that has a /20 after a dot something. So it'd match domain.com/something/2042 in addition to what you're asking for. You may need something more specific than that.

@ZachSaucier
Copy link
Owner

Just Read allows for sites to automatically be added to the auto-run list and there is an optional context menu entry to add the current page to the auto-run list. See this post for more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants