alandmoore / admbrowser

A Web browser for kiosks and digital signage, based on Python, PyQt, and Blink
35 stars 22 forks source link

CSS overwrite statements in .yaml file #28

Open stroobandt opened 1 year ago

stroobandt commented 1 year ago

This is an idea that originates from the surf browser. Suckless.org's surf is a small WebKit2/GTK+ based browser that I used to use quite often before encountering this great WebEngine/PyQt5 ADMBrowser.

surf allows to write a couple of CSS statements that will overwrite some of the CSS of a known web site. This results to be a handy way to eleminate ads and other annoyances or rather to emphasise parts of a web page one is interested in.

Here is an actual example for some of the named CSS classes of the domain rtl.fr:

.ads, .legal-notice, .newsletter, .produit {display: none !important;}
.hResultPrincipal {font-size: 175% !important;}

CSS overwrite statements would be a great and natural addition to ADMBrowser's .yaml site-dependent configuration files. It would also solve the issue of ADMBrowser users currently being exposed to ads that could be perceived as offensive in an educational or public library setting.

alandmoore commented 1 year ago

Seems like a reasonable feature to have. Would it be better to have it keyed on some kind of URL regex matched against the primary URL?

stroobandt commented 1 year ago

Seems like a reasonable feature to have. Would it be better to have it keyed on some kind of URL regex matched against the primary URL?

I would already be very happy when CSS overwriting worked on a URL domain level, but URL regex matching would certainly be a nice refinement, provided it does not complicate matters too much.

Personally, I usually remain on the same domain as the start_url as defined in the .yaml, but I certainly recognise the use cases where URL matching becomes important. That would be when the start_url refers to a search or index page.