Toaster — everything into the composter. Filter and enjoy

It so happens that a Russian Q&A resource on IT is quite popular in the CIS — ToasterHowever, something was missing when I started getting familiar with it. This led to improvements in the form of a browser extension. Meet it.

Key features:

  • Name: Toster Comfort.
  • User statistics: percentage of questions solved; karma from Habr; summary from profile — all this is included in the list of Toster's questions.
  • Notifications: in real-time on the site, on the icon, plus push notifications, with many settings, the site needs to be open (wiki).
  • Filters: conditions based on formulas: you can hide questions, color them, and show notifications — all of this can be flexibly adjusted with logical conditions (wiki).
  • Interface: minor improvements, for example, showing exact dates or displaying subscription status in the list of questions.
  • Habr Interface: minor improvements (optional), for example, lines for indentation in comments.
  • Open source: you can modify it for yourself if you really want to (the source code).
  • Free: MIT License.
  • Memory consumption: 30-50MB, depending on options and intensity of Toster usage
  • Size: 93KB for v0.8.1 (unpacked, non-minimized code).
  • Framework: none, pure JS (minimalism).
  • Code quality: average, mixed styles, large functions, messy techniques, few comments.
  • Permissions: toster.ru, habr.com, notifications, storage, unlimitedStorage

Originally, the extension was made for myself with one simple goal: to show the percentage of questions where the user clicked the 'Mark as solved' button. Gradually, various other features were added until the tool grew into a hundred-kilobyte monster. Nevertheless, the principle of 'not using anything unnecessary' was maintained until the end.

One of the main features now is the use of formulas in the settings. With them, you can do almost anything, tailoring your attention management. The main thing is to know what you want. Hiding, changing colors, and notifications are the three main aspects of attention while working with the site. Filtering everything is the key to convenience.

An example of a flexible rule that allows you to receive notifications on a specific topic:

!tag("Ad Blocking") && !contains(t,"ads") && contains(t,"block") && !tag("HTACCESS") || containsWord(t,"rkn") || contains(t,"roskomnadzor") || contains(t,"roskompозор") || contains(t,"government") || contains(t,"prohibited") || contains(t,"banned") || contains(t,"pirate") || containsWord(t,"bypass") || containsWord(t,"rostelecom") || containsWord(t,"yarovaya") || containsWord(t,"rf") && tag("Computer Networks") = notify

Let me say right away that the eval() function shouldn’t be used. So there’s not much room for creativity. Therefore, I had to write my own workaround with 5 KB of code using reverse Polish notation. This can be regarded as a heavily restricted JS, both in terms of functions and syntax.

Recently, there was a post about Toster Extension. Compared to it, TE has a more user-friendly interface and some features that Toster Comfort lacks. However, my extension focuses on resource consumption. Still, nothing prevents you from using both extensions; they shouldn’t conflict.

In an ideal world, TC should be rewritten from scratch because the performance can be improved at least twofold, and cache handling could be ten times more efficient by eliminating localStorage and JSON.stringify() and changing some architectural decisions. But this feat isn't for me to tackle. I’m a fan of the principle "if it works, don’t touch it." For now, while on vacation, I’m actively accepting issues and PRs, but not at the expense of minimalism. Thank you for your attention!

Source: habr.com

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster