Do you think I could just leave this part blank and it'd be okay? We're just going to replace the whole thing with a header image anyway, right?
You are not logged in.
Pages: 1
every single spoiler has that piece of javascript
if i go ahead and spam spoilers like a madman
this page now has a lot of repeated javascript for no reason - 27,374 bytes
now here is my suggestion - create a simple spoilerScript function that accepts one input, c
now compare this output - 5427 bytes
the latter is much cleaner, and probably saves somewhere of 350-450 bytes per spoiler.
heres the spoilerScript function - i didn't even have to do much to modify it
var spoilerScript = function(c)
{
var e,d,a=c.getElementsByTagName('div')[1],b=c.getElementsByTagName('span')[0];if(a.style.display!=''){while(c.parentNode&&(!d||!e||d==e)){e=d;d=(window.getComputedStyle?getComputedStyle(c, null):c.currentStyle)['backgroundColor'];if(d=='transparent'||d=='rgba(0, 0, 0, 0)')d=e;c=c.parentNode;}a.style.display='';b.innerHTML='▲';}else{a.style.display='none';b.innerHTML='▼';}
}
Offline
if i go ahead and spam quotes like a madman
ahem that are spoiler snot quotes
thanks hg for making this much better and ty for my avatar aswell
Offline
ninjasupeatsninja wrote:if i go ahead and spam quotes like a madman
ahem that are spoiler snot quotes
fixed
Also some improvements has been made. I've created this minified js
var ssoc=function(e){var t,n,a=e.parentNode,r=a.getElementsByTagName("div")[1],l=e.getElementsByTagName("span")[0],o="none",p=6;if(""!=r.style.display){for(;a.parentNode&&(!n||!t||n==t);)t=n,"transparent"!=(n=(window.getComputedStyle?getComputedStyle(a,null):a.currentStyle).backgroundColor)&&"rgba(0, 0, 0, 0)"!=n||(n=t),a=a.parentNode;o="",--p}r.style.display=o,l.innerHTML="`"+p+"0;"}
which should behave exactly the same as the spoiler code, however, it is 10 bytes smaller than the js attatched to every onclick handler - and it should work properly now
Offline
Pages: 1
[ Started around 1732378947.2843 - Generated in 0.064 seconds, 12 queries executed - Memory usage: 1.49 MiB (Peak: 1.66 MiB) ]