Toaster - everything in the composter. Filter and enjoy

It so happened that the Russian Q&A resource on IT topics is quite popular in the CIS - Toaster. However, he lacked something when I began to get to know him closely. This resulted in an improvement in the form of a browser extension. Meet.

Key features:

  • Name: Toaster Comfort.
  • User stats: percentage of questions with a solution; karma from Habr; summary from the profile - all this in the Toaster's list of questions.
  • Notices: real-time on the site, on the icon, plus push notifications, many settings, the site must be open (wiki).
  • Filters: formula-based conditions: you can hide questions, color them, and show notifications - all this is flexibly configured in the form of logical conditions (wiki).
  • Interface: minor improvements, such as showing exact dates or displaying subscription status in the list of questions.
  • Habr interface: minor improvements (optional), for example, indentation lines in comments.
  • Open-source: you can change it to your liking if you really wantsources).
  • Free: MIT License.
  • Memory Consumption: 30-50MB, depending on the options and intensity of use of the Toaster
  • Size: 93KB for v0.8.1 (unpacked, not minified code).
  • Framework: missing, clean JS (minimalism).
  • Code quality: average, mixing styles, big features, dirty tricks, few comments.
  • Permissions: toster.ru, habr.com, notifications, storage, unlimitedStorage

Initially, I made the extension for myself with one single purpose: to show the percentage of user questions in which he bothered to click the "Mark as solved" button. Then, little by little, one or the other Wishlist was added, until the tool grew into a monster of a hundred kilobytes. Nevertheless, the principle of "do not use anything superfluous" was respected to the end.

One of the main features now is the use of formulas in the settings. With them, you can do almost anything, any Wishlist to manage your attention. The main thing is to know what you want. Hiding, color changing, and notifications are the top three things to keep in mind when working with a site. Filtering anything and everything is the key to convenience.

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

!tag("Π‘Π»ΠΎΠΊΠΈΡ€ΠΎΠ²Π°Π½ΠΈΠ΅ Ρ€Π΅ΠΊΠ»Π°ΠΌΡ‹") && !contains(t,"Ρ€Π΅ΠΊΠ»Π°ΠΌ") && contains(t,"Π±Π»ΠΎΠΊΠΈΡ€ΠΎΠ²") && !tag("HTACCESS") || containsWord(t,"Ρ€ΠΊΠ½") || contains(t,"роскомнадзор") || contains(t,"роскомпозор") || contains(t,"государств") || contains(t,"Π·Π°ΠΏΡ€Π΅Ρ‰Π΅Π½") || contains(t,"Π·Π°ΠΏΡ€Π΅Ρ‰Ρ‘Π½") || contains(t,"пиратск") || containsWord(t,"ΠΎΠ±Ρ…ΠΎΠ΄") || containsWord(t,"ростСлСком") || containsWord(t,"яровой") || containsWord(t,"Ρ€Ρ„") && tag("ΠšΠΎΠΌΠΏΡŒΡŽΡ‚Π΅Ρ€Π½Ρ‹Π΅ сСти") = notify

I must say right away that the eval () function could not be used. So don't get too carried away. Therefore, I had to write my crutch for 5 KB of code using reverse polish notation. This, one might say, is heavily castrated JS, both in function and in syntax.

Recently there was a post about Toster Extension. By comparison, TE has a nicer interface and some features that Toster Comfort does not have. However, my extension focuses on resource consumption. However, no one bothers to use both extensions, they should not conflict.

In a good way, TC needs to be rewritten from scratch, because work can be speeded up at least twice, and work with the cache - 10 times faster, by abandoning localStorage and JSON.stringify() and changing some architectural solutions. But this feat is not for me to do. And I am a fan of the principle "works - do not touch." While on vacation, I actively accept issues and PR, but not to the detriment of minimalism. Thank you for your attention!

Source: www.habr.com

Add a comment