r/reddithax • u/Goctionni • Jul 30 '15
Reddit CSS and randomization
Hello,
I was wondering if anyone knew of any html elements or alike that could be used to generate random "events". What I mean is (for example) hiding an element 9 out of 10 visits.
For aprils fools I used the reddit post ID to "randomly" prefix all posts on my subreddit with fairly random strings of text (ie: "[Astronaut]").
Example CSS:
[data-fullname$="p"] p.title > a.title:before {
content: '[Astronaut]';
}Now I'm looking for CSS that will simply appear only one in so many (random) page visits. So far I've not really been able to find any elements that I could hook onto as a randomizer.
2
Upvotes
View all comments
Show parent comment
2
u/Goctionni Jul 30 '15 edited Jul 30 '15
Yeah I'd found that I needed to get to the <a> element after also. Aside from overlaying something over the entire thing, is there any known way to avoid the onclick behavior for the :after element?
[edit] I've found that RES adds some random id to it's "Use subreddit style" checkbox. Hypothetically it should be possible to hook onto that and fallback to the logout element when the body tag doesn't have the "res" class, right?
That seems at least a minor improvement :s.
[edit2] Found:
Works perfectly in chrome, but apparently not so much in some other browsers. Will need to do some testing.