-
Notifications
You must be signed in to change notification settings - Fork 345
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
Make selfoss navigable #834
Conversation
This pages modifies the client ui to make heavy use of location.hash: hash changes are now responsible for loading the entry list. Another big change is that the server side template is basically empty of any data. It is loaded via the same client side code responsible for updating item lists, tags, stats, etc.
Regarding the second part, I discovered some edge cases:
I did not check the code in 8b7f8d2 very deeply yet. |
Agreed with @jtojnar, here is some explanation in regard to why offset/limit pagination is considered bad. |
Point 1, I cannot reproduce with multiple unicode strings using Chromium as browser. |
Indeed, it seems to work in Chromium as As for the seek pagination, my bad. The items would have to be sorted by Although I think the performance difference will be negligible in most installation, as selfoss, by default, collects garbage after 30 days, it would result in code that is much cleaner and thus more prone to bugs, which IMHO is more important value; any performance increase would be a nice bonus. |
The problem is explained there : http://stackoverflow.com/questions/1703552/encoding-of-window-location-hash As a summary, the hash exposed in JS in Firefox is already URL-encoded, which is not the case in Chrome for instance.
Apparently the Firefox behaviour is correct one, since Location.href ought to return URL’s fragment, which is described as an ASCII string. Interestingly enough, until 2015 Firefox behaved the same way as Chromium. On the other hand, Safari, IE and old Opera are correctly returning encoded hash, so this should probably be reported as Blink interop bug. Since the Decoding the hash as in d02a159 would fail in non-compliant browsers like chromium when the tag contains a percent sign. |
Regarding seek pagination, I do not understand why |
Because multiple rows could have the same timestamp, you only want the ones after the last one you got. |
Indeed.
See a more detailed writeup about the seek pagination: http://use-the-index-luke.com/sql/partial-results/fetch-next-page |
@@ -71,7 +71,7 @@ selfoss.events.navigation = function() { | |||
$(this).addClass('active'); | |||
|
|||
if($(this).hasClass('nav-tags-all')==false) { | |||
location.hash = '#' + selfoss.filter.type + '/tag-' + $(this).find('span').html(); | |||
location.hash = '#' + selfoss.filter.type + '/tag-' + $(this).find('span').html().replace('%', '%25'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should probably be encodeURIComponent($(this).find('span').html())
. Works both in Chromium and Firefox.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but I had preferred the browsers to show a unencoded string in the address bar. I've also tested with both browers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid that is Chromium issue, Firefox displays the hash decoded. It would be nice if someone with access to Safari could test how it behaves there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It also works with the firefox I have (Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Firefox/50.0
).
- slightly better performance - easier to read than extra explicitely requested entries for fixing fossar#774
In a brief inspection it looks really nice. However, 2999994 broke clicking the entry source to get to source listing. Two clicks are now needed. |
Looks nice. And while I am nitpicking, when you click the entry source, the source in the sidebar will be highlighted only after the listing finished loading – the other way around than when clicking the source in the sidebar. |
Yes, but the only way to fix this would be to make two AJAX requests: the first to load the source navigation sidebar items, the second to load the new filtered list of items. The current implementation loads both ressources using the same request, which should be a bit faster. |
Hash is processed asynchroneously, which would cause ajax requests to be sent with an opened entry on slow devices. This change ensures the hash is processed in that case.
This changes doesn't work with my sqlite database: Ein Fehler ist aufgetreten: PDO: no such column: TRUE [selfoss/libs/f3/base.php:2032] Base->error(500,'PDO: no such column: TRUE') [selfoss/daos/mysql/Items.php:286] DB\SQL->exec('SELECT items.id FROM items AS items, sources AS sources WHERE items.source=sources.id AND TRUE LIMIT 1 OFFSET 50',array()) [selfoss/daos/Items.php:83] daos\mysql\Items->get(array('starred'=>false,'offset'=>'0','search'=>'','items'=>50,'offset_from_datetime'=>'','offset_from_id'=>'','itemsPerPage'=>'50','type'=>'newest','tag'=>'','source'=>'','sourcesNav'=>'false','ajax'=>'true')) [selfoss/controllers/Index.php:243] daos\Items->get(array('offset'=>'0','offset_from_datetime'=>'','offset_from_id'=>'','itemsPerPage'=>'50','search'=>'','type'=>'newest','tag'=>'','source'=>'','sourcesNav'=>'false','ajax'=>'true')) |
These patches make selfoss navigable using the url hash. This makes the url reflect whats displayed in selfoss. This also makes it possible to reload the item that was open before a browser crash or when the tab containing selfoss was offloaded from memory on a mobile browser.