misc/hats_js_anim.xhtml
changeset 13409 697aaee36684
parent 12927 9400a272c88f
child 13410 7487e683c6b6
equal deleted inserted replaced
13408:419c5eab88eb 13409:697aaee36684
   103     for(var theme in themes)
   103     for(var theme in themes)
   104     {
   104     {
   105         sel.appendChild(opt.cloneNode(true));
   105         sel.appendChild(opt.cloneNode(true));
   106         sel.lastChild.value = theme;
   106         sel.lastChild.value = theme;
   107         sel.lastChild.lastChild.data = theme;
   107         sel.lastChild.lastChild.data = theme;
   108         if(theme == "Nature") sel.lastChild.selected = true;
   108         if(theme === "Nature") sel.lastChild.selected = true;
   109     }
   109     }
   110     var chk = document.createElement("input");
   110     var chk = document.createElement("input");
   111     chk.type = "checkbox";
   111     chk.type = "checkbox";
   112     chk.onclick = switchAnim;
   112     chk.onclick = switchAnim;
   113     document.body.appendChild(chk);
   113     document.body.appendChild(chk);
   114     chk = chk.cloneNode(false);
   114     chk = chk.cloneNode(false);
   115     chk.onclick = hideGirders;
   115     chk.onclick = hideGirders;
   116     document.body.appendChild(chk);
   116     document.body.appendChild(chk);
   117     var s = document.styleSheets[0].cssRules;
   117     var s = document.styleSheets[0].cssRules;
   118     for(var i=0;i<s.length;i++)
   118     for(var i=0;i<s.length;i++)
   119         if (s[i].selectorText.toLowerCase()==".girder") girder = s[i];
   119         if (s[i].selectorText.toLowerCase() === ".girder") girder = s[i];
   120         
   120         
   121     var a = document.createElement("a");
   121     var a = document.createElement("a");
   122     var g = document.createElement("div");
   122     var g = document.createElement("div");
   123     g.className="girder";
   123     g.className="girder";
   124     a.appendChild(document.createElement("div"));
   124     a.appendChild(document.createElement("div"));
   129         h.href = "//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Graphics/Hats/"+masks[i]+".png";
   129         h.href = "//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Graphics/Hats/"+masks[i]+".png";
   130         h.lastChild.style.backgroundImage = 'url("'+h.href+'")';
   130         h.lastChild.style.backgroundImage = 'url("'+h.href+'")';
   131         h.lastChild.lastChild.data = masks[i];
   131         h.lastChild.lastChild.data = masks[i];
   132         h.title = masks[i];
   132         h.title = masks[i];
   133         h.idle = Math.floor(Math.random()*19);
   133         h.idle = Math.floor(Math.random()*19);
   134         if (i%17==16 || i==masks.length-1) document.body.appendChild(g.cloneNode(false));
   134         if (i%17 === 16 || i === masks.length-1) document.body.appendChild(g.cloneNode(false));
   135     }
   135     }
   136     
   136     
   137 /* quick and dirty animation */
   137 /* quick and dirty animation */
   138 animationInterval = setInterval(animateHogs, 128);
   138 animationInterval = setInterval(animateHogs, 128);
   139 }
   139 }
   182 //]]>
   182 //]]>
   183     </script>
   183     </script>
   184 </head>
   184 </head>
   185 <body>
   185 <body>
   186 <h1>List of Hedgewars hats</h1>
   186 <h1>List of Hedgewars hats</h1>
       
   187 <noscript>
       
   188 <p><strong>ERROR</strong>: We're so sorry, but this webpage only works with JavaScript enabled. It seems JavaScript is disabled or not supported in your browser.</p>
       
   189 <p>Normally, this webpage would display an animated preview of the hats in Hedgewars.</p>
       
   190 </noscript>
   187 </body>
   191 </body>
   188 </html>
   192 </html>