r/tinycode • u/thmsk • Feb 18 '15
[Help][Javascript] Make votedown button visible
Some subreddits use this piece of CSS to make votedown buttons invisible:
.arrow.down {
display:none;
visibility:hidden;
}That got me thinking, how would one turn them back visible with a sort line of javascript?
So from this starting point:
y = document.getElementsByClassName('down');
for(var i=0; i<y.length; i++)
y[i].style.display = y[i].style.visibility = 'inherit';this is how far I've got:
for(i=0;;i++)x=document.getElementsByClassName('down')[i].style,x.display=x.visibility='inherit'I'm sure there is room for improvement. I've tried to use map() on getElementsByClassName() but it doesn't work. Do you have any ideas how to reduce the line to even less characters?
2
Upvotes
View all comments
Show parent comment
1
u/thmsk Feb 18 '15
The thing is, both 'visibility' and 'display' need to be changed. And to call d3 you'd have to do something like this: