css file could use new line for site specific rules
Closed this issue · 4 comments
There filters using advanced hiding rules which are site specific. See example 1 or 2. I am no HTML expert, but my gut feeling says in such cases one probably would benefit more if converter sends such records having rules located in parenthesis into the separate line instead of placing it in default which only has {display:none!important;visibility:hidden!important}
I’m not tracking this issue. Would you please provide more details and explain them to me?
Lets say rules set has following rules
wykop.pl##.advert
wykop.pl##.banner
wykop.pl##.cookie
wykop.pl##.type-permanent+#nav+div:style(padding-top: 49px !important;)
wykop.pl##.type-permanent+#nav:style(top: 0px !important;)
Currently all element hiding rules are placed in one line, separated by commas and ending with {display:none!important;visibility:hidden!important}
however in some of those cases it would be more beneficial if they are placed in separate lines and file pl/wykop/ab2p.css would look as follows
.advert,.banner,.cookie{display:none!important;visibility:hidden!important}
.type-permanent+#nav+div{padding-top: 49px !important}
.type-permanent+#nav{top: 0px !important}
EDIT: According to the guys from filter list when moving rule to new line it is also important to leave out :style
as it is adblock specific feature and replace ()
with {}
After removing all generic hide elements and changing source not too inlcude 4000 elements, but only 1 per line it become easy to workaround this particular issue with help of sed.
CSS after being prepared by adblock2privoxy had
.type-permanent+#nav+div:style(padding-top: 49px !important;){display:none!important;visibility:hidden!important}
.type-permanent+#nav:style(top: 0px !important;){display:none!important;visibility:hidden!important}
Now with use of sed
sed -i -e 's:\:style(:{:' -e 's:;){display\:none!important;visibility\:hidden!important}:}:' wykop/ab2p.css
it lookes like it should which is:
.type-permanent+#nav+div{padding-top: 49px !important}
.type-permanent+#nav{top: 0px !important}
This is far from pernament fix as the file should get generated like this in the first place, but it gets the job done :)
The ab2p.css
files all have valid comma separated syntax and to the best of my knowledge all work as intended. See https://www.w3schools.com/cssref/sel_element_comma.asp.