Giter VIP home page Giter VIP logo

already-seen's People

Contributors

ryanberckmans avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

already-seen's Issues

Use a "least recently used" scheme for link storage

Currently, when storage is full, 25% of seen links are erased. Due to an implementation detail these 25% are typically the least recently used/seen.

Formalize "least recently used" as follows

  • The storage data structure should be converted to [StoredEntry], where StoredEntry is an object containing at least key: string and lastSeen: UnixTimestamp
  • StoredEntry is a backwards incompatible change for current [string] schema; the storage loader should add a "live migration" so that any previously stored links are migrated to the new data structure
  • A hardcoded number of links should be retained in storage, maybe 5000. Potentially this number could be much higher if #3 is completed.
  • Potentially links should automatically be erased if they were last seen prior to (now minus a hardcoded duration). Because users may want to see links they saw eg. 6 months ago if they come up again in pop culture, potentially in a new context or with new discussion.
  • When attempting to save more links than allowed, the least recently used links should be erased.
  • Prior to save, when merging links currently on page with previously seen links, the newer lastSeen should be retained.
    • Currently this algorithm is just a Set construction const entryKeysAlreadySeenIncludingNewOnesOnThisPage = Array.from(new Set(entryKeysAlreadySeen.concat(allEntriesOnPage.map((e) => e.key))));

Use Tampermonkey/Greasemonkey storage instead of localStorage

"If people have configured their browser to purge cookies on exit, localStorage is wiped, too. Tampermonkey provides an internal mechanism at GM_getValue and GM_setValue (doc) that persists and is not counted towards the page store size."

Author: u/AyrA_ch https://www.reddit.com/r/GreaseMonkey/comments/amai2g/autohide_reddit_links_after_youve_seen_them_once/efl4ry1/

I'd be interested to support localStorage as well, perhaps as follows:

  1. refactor current localStorage method to use something like a Storage interface
  2. implement Storage for GM_getValue/GM_setValue and make this the default Storage implementation

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.