ansh / jiffyreader.com

A Browser Extension for faster reading on ANY website!
https://www.jiffyreader.com/
GNU General Public License v3.0
3.77k stars 201 forks source link

Prefs getter #117

Closed paxelpixel closed 2 years ago

paxelpixel commented 2 years ago

Added a prefs getter to get the current preferences which is either "local" or "global" which ever is selected by the user on the current tab.

Example, if you want to get the current preference

// Initialize Preferences with a getOrigin function that "knows how to get the origin of the current tab
// and it will return an object to set and get preferences, 
// one of its methods are getPrefs, which you can 
// use to get the current preferences, so if the user is currently
// using the global prefs, it will return that, and if they are using
// "per site", it will return that preference of that site
const { getPrefs } = Preferences.init({
    getOrigin: async () => TabHelper.getActiveTab(TabHelper.getOrigin),
});

const currentPrefs = await getPrefs()
// {
//  saccadesInterval: 0,
//  lineHeight: 1,
//  fixationStrength: 2,
//  scope: 'global',
//  onPageLoad: false,
// }
asieduernest12 commented 2 years ago

this will be helpful,

next features i guess are beeline coloring and finding a way to let users submit css selectors into the extension to be ignored only on their browser or we could make an opt in/out where selectors per site are sent to some online cloud store so one user excluding something on a popular site will then be available to all users. we would probably need to have a vetting of submissions before allowing them. but just a thought

paxelpixel commented 2 years ago

beeline coloring

first time I've heard of beeline coloring! that sounds interesting! I will look into that.