GabLeRoux / webextensions-history-browser

🕘 Browse your firefox history like a boss.
https://addons.mozilla.org/en-US/firefox/addon/webextensions-history-browser/
MIT License
20 stars 1 forks source link

Display the list of entries in chronological order #24

Open GabLeRoux opened 5 years ago

GabLeRoux commented 5 years ago

Right now, the extension uses webextensions search history as shown here:

https://github.com/GabLeRoux/webextensions-history-browser/blob/db85c3e4a1779a625feb4a6806f8a86d9926edae/src/js/history.js#L26-L38

But the extension should probably use history​.get​Visits() for the actual complete history of visits.

Thanks to Paul (rovyko) again here, here's what he shared me:

I actually started working on my own extension to show a compact, but chronologically correct history in the sidebar. I managed to get a working extension, but didn't finish it, mostly because the Firefox API doesn't support a key feature and I'm not interested in Chrome.

You're right about the chronological items. You can get a full list using the HistoryVisit API, but this will return visits across the entire timeline. I found that if you want to get the next (earlier) n HistoryVisits after a certain datetime, you'll need to get the next n HistoryItems first, then combine their visits, and then get only the top n HistoryVisits. If you try to get more than n visits from n items, you may end up with gaps if the n+1th visit belongs a HistoryItem that wasn't one of the original n.

I managed to implement a rudimentary system that you can check out here: https://github.com/rovyko/historian/blob/master/src/tools/history.js

GabLeRoux commented 5 years ago

The implementation is not available through edge so implementing this will probably invalidate #17 but I'm ok with it :)