The Good
I have created a simple pagination extension for chrome. Although I have zero interest in pagination and I prefer scrolling, I decided to make this extension as a proof of concept.
The extension adds five buttons below the timeline, one for the first and last page, one for the next and previous pages and a button with the current page. This is the github repo for the extension:
https://github.com/meredoth/Unity-Discourse-Pagination
It is under GPL v3, so you can change the code as you see fit.
The Bad
Discourse is not designed to support traditional pagination. By examining Discourse’s code and its API, the best approach is to create an extension like this one, which links to specific posts in a topic and treats a set number of posts as a “page.” In this extension, each “page” contains 20 posts, but this can easily be adjusted in the extension’s code.
This is not traditional pagination, as users can continue scrolling down on any page. The extension updates the current page number button even when the user scrolls and stops, and the next and previous buttons are evaluated lazily. This means that when clicked, these buttons will navigate to the next or previous “page” from the current position, not from the original “page” where the user started scrolling when the buttons were first created. This functionality is possible because the extension uses the new navigation events API. Unfortunately, this API is not yet supported in Firefox and Safari, so anyone wanting to adapt this script for these browsers will have to wait or use a more complex solution.
While having both scrolling and pagination might seem beneficial to some users, I believe implementing such a feature server-side, could significantly hinder the forum’s performance.
The Ugly
I am always amazed by programming communities that constantly complain about certain functionalities, argue about how easy they would be to implement, and offer opinions on their implementation. These users often spend their time writing critical posts instead of actually creating the solutions themselves.
I can understand non-programmers complaining about the lack of pagination. However, if you are a programmer who has been complaining about this on the forums instead of spending three hours to read the Discourse API and write a simple script of fewer than a hundred lines, you might need to reconsider your approach to programming.
Especially if you belong to the camp of “Unity is not open source, so I cannot make changes to the engine”, wanted pagination functionality, and have not taken the time to write a simple script like this for Discourse, which is open-source with a great API for extensions and plugins, then maybe programming isn’t for you.
As I mentioned at the beginning of this post, I have zero interest in pagination, so I will not be making any changes to this script. Use it as a starting point for your own needs. I don’t intend to maintain or support this extension as it is not useful to me and I strongly dislike frontend work, so any changes or improvements you might need — such as modifying the buttons to suit your preferences, because they are too old, too fat or too blond — should be done by you.