Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

css file could use new line for site specific rules #11

Closed
wmyrda opened this issue Jun 6, 2018 · 4 comments
Closed

css file could use new line for site specific rules #11

wmyrda opened this issue Jun 6, 2018 · 4 comments

Comments

@wmyrda
Copy link

wmyrda commented Jun 6, 2018

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}

@essandess
Copy link
Owner

I’m not tracking this issue. Would you please provide more details and explain them to me?

@wmyrda
Copy link
Author

wmyrda commented Jun 14, 2018

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 {}

@wmyrda
Copy link
Author

wmyrda commented Jul 9, 2018

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 :)

@essandess
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants