📜 ⬆️ ⬇️

habrAllHub - a toggle between All Blogs and My Favorite Blogs

Reincarnation of the "Read all hubs" button with the ability to return to reading selected hubs (blogs); works with authorization; Selection settings are portable via JSON.

This button was “broken” and promised that “for good” by the site developers on March 14, 2012. But a holy place is never empty, and its weakened client “spirit” appeared.

The script saves all your blog settings in one big JSON string, which is stored in the browser’s storage (will not be lost in case of power failure) and which can be pulled out for export (the Import-Export button) to other browsers and computers (you can use it , to "see the eyes of others"). The “All / Own” switch button makes an easy choice between all blogs or your favorites. In fact, this is a replacement for the former “Read All” mode removed from the site. Other existing solutions require donating something: choose “everything” manually (this means losing your favorite blogs), read habrahabr.ru/posts/collective and habrahabr.ru/posts/collective/new (blogs of companies will be skipped) - discussion in QA .
')
Go to the script page . Immediately download the habrAllHub script .

Disclaimer


The script is written to perform useful functions for the user:
1) saving user choice of blogs, regardless of the functions of the site in the storage of the browser and in text format JSON;
2) the ability to view all blogs (the "All" button) through a temporary overwrite of server-based blog reading settings;
3) the ability to restore the settings (the "Own" button) from the storage or from a text format taken from another browser or from another user (the "Export / Import" button - (">")).

Due to the “temporary overwriting” using the undocumented and inconsistent with the manufacturer protocol, it is possible that the script suddenly stops working , user settings saved locally will no longer be read by the server. In addition, the identifiers and names of blogs are constantly (and inconsistently) changed by the manufacturer , so there is no guarantee that the settings saved for a long time will work correctly in the future. Therefore, you need to use the script carefully, saving (preferably, before each period of viewing the site in the “All blogs” mode) settings in text format (the “Export / Import” button). But, one way or another, the user will never be insured against losing the entered data - “Ribbon Settings” . The main thing is that the script gives many chances not to type the settings manually after viewing in the “All blogs” mode.

The duration of the process of changing settings


When reading and writing settings, there is a long (10-30 seconds; data - about 20-30 KB) data exchange with the server. Therefore, working with settings in general is not an easy function for a server channel. This should be understood and not abused by the process of switching settings on the site. It also gives an understanding of why the process of switching to “Everything” and back is so long and why there is a button “Read”. It is to ensure that when switching settings it is not always pre-read the settings from the server. The first click “All” is a costly operation, and each new click on “Read” is also a costly operation, more costly than “Show settings” in the “Ribbon Setup” section. Therefore, the script reads the settings only at the first reading (then takes them from the repository) or when you click "Read."

But from time to time “Read” is necessary. The browser has to trust the user in the storage and server synchronization. If the user has changed the settings through another browser , then clicking “All” in the current browser will erase the server settings. Therefore, it is only the responsibility of the user to click “All” or “Read” and then “All”. (Here on the server, the indication of the save date or the checksum of the settings would not hurt, which is even better, so that with each discrepancy, start to understand through the "Read", but this is not.)

If you open the site on another computer without going to the "Own" mode in advance, the server will not have your settings. They need to be transferred separately and imported (button ">" - Ctrl-V). Finally, if you log into Habr after working under a different login, the new login will accept the saved settings as its own, i.e. The script does not distinguish whose settings it is. However, this is the simplest thing to teach him, add the username to the settings.

Such inconveniences remain after the “All” button, supported by the site, disappears. Perhaps in the future, the server interface will receive a checksum and an open protocol to remove the Read button from the user interface.

Therefore, the TODO for the administration is to have a command to compare the checksum of the local settings of blogs and server settings. This will make monitoring changes to the server side extremely easy. And even easier - it would be to have this checkbox "Everything" on the server :).

Reasonings why the “Everything” checkbox was deleted and what should be done


In the description of the spring update, the authors clearly explained the reasons for removing the “All” button from the ribbon settings. Retell them here.

The user, having chosen the “All” tape, starts counting blogs, in whose content he is poorly versed, with his own controlled blogs. Consequently, he puts the marks of assessments, based on his own, subjective understanding of the value of articles from unfamiliar subjects. To avoid “negative” from such users, we decided to remove the “Everything” button and at the same time, other loopholes for viewing all articles in a row. Leaving, nevertheless, the opportunity to simply, “stupidly,” select all categories.

The solution, IMHO, requires more flexibility: to change the responsibility of scoring for those who have selected all the blogs, manually or automatically. For example, lower the weight of the score to zero if “All” is selected. However, this is also not a solution - then there will be nowhere to take the initial “pluses”, because the main starting appraisers are just the people who watch “All”.

And, maybe, it is necessary to introduce an “evaluation profile” - so that a user who chooses “All” or very much, must also choose a subset of what he has the right to evaluate, and this will coincide with his subject of comments, articles and “liked” ( and these are just selected blogs). Otherwise, his estimates will not be taken into account (or taken into account with a small weight). Such flexible formula mechanics will give exactly the right mechanism. As long as the user has not established himself as an author or commentator respected in certain topics, he will have little base weight, which, if sprayed on all blogs, will be even less. And authors with a weight will either expand their assessment abilities, or have a high evaluation weight in a narrow range of topics chosen.

Why it was made, the button "All"


I, like everyone else, did not want to lose the settings of blogs and overwrite them with manual selection of all categories. I think they will come in handy sometime. After all, this is my answer to the question: “Which blogs do you prefer?”.

How to transfer settings between computers now?


Yes, due to the mashing of your choice of settings, there is a chance that on another computer in another place you will open the site, and there everything is chosen. And this is your doing:) (except for politics). In order not to get into an inconvenient situation, carry your settings on the Net (for example, in the mail) - a text file of 10-30 KB in size. With it, you can import your previous blog settings. True, there is no guarantee that the format will not become obsolete and will not cease to be read. But this is better than manually restoring the settings of hundreds of blogs. And, by the way, all this does not matter ... except for the bees.

Interesting and useless chips


1. You can monitor the total number of categories, blogs and the number of selected blogs by reading the categories in the console - the line is displayed:

'== allBlog' Object {cat = 15, blog = 133, allBlog = 326} ...
(When collecting data, the category of company blogs did not work - MySQL error, otherwise there would be more blogs.)

2. You can view the allBlog object with all content received from the server in Firebug by typing “allBlog” + Enter in the console.

3. To get a list of all blogs in JSON, set FAST = 0; in the script.

5. Compatibility with HabrAjax - from version 0.816+ (from today). (In other words, update the version of HabrAjax, otherwise the buttons for switching blogs will not be visible.)

6. Photo gallery. Single script. With HabrAjax. C HabrAjax + ZenComment (always on the screen).


7. To see the results, you need to reload the page.

8. The site page monitors the repository in case of changing the settings on another page and displays the mismatch between the page and the server in time - it writes “reload”.

9. The script tries not to wipe the useful data with meaningless. If you give the “Read” command to all selected blogs, the script will refuse to remember such data, recognizing them by the signs. But just in case, it is useful to have a text copy of the settings.

10. Just in case, the script shows how many bytes sent to the server to guess if it installed “All” or details. If it shows something like “installed on server 452” - this is “Everything”. If it is much more, for example, "installed on server 5876" - this is your settings.

And once again about the dampness


I repeat, because it is important. The software used is raw, both on the server and in the user script. The server can easily give an error, as now, for example, gives an error on corporate blogs. Therefore, the script is made more flexible than it could be. The “Read” button, which is not necessary under normal conditions, was added and clicks on the active buttons were left. Because emergency situations are possible. Therefore, first of all, save the line of your settings for export (press the ">" button, Ctrl-C, Ctrl-V).

Impressions


It turned out what was needed - with one click hundreds of its settings are restored in about 5 seconds. If you save the settings outside the browser, you can safely dive into the "Read All" mode and you will be surprised how wider the world is in the framework you set.

Source: https://habr.com/ru/post/140227/


All Articles