misc/hats_js_anim.xhtml
branchios-develop
changeset 13413 ba39a1d396c0
parent 13410 7487e683c6b6
child 13507 7e188a28f078
equal deleted inserted replaced
13411:6e8b807bda4b 13413:ba39a1d396c0
     7     <style type="text/css">
     7     <style type="text/css">
     8 * {padding: 0; margin: 0; }
     8 * {padding: 0; margin: 0; }
     9 body 
     9 body 
    10 {
    10 {
    11     background: url('//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Themes/Nature/Sky.png') fixed no-repeat bottom left;
    11     background: url('//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Themes/Nature/Sky.png') fixed no-repeat bottom left;
       
    12     background-color: #0B203D;
       
    13     color: #FFD902;
    12     -moz-background-size: 200%;
    14     -moz-background-size: 200%;
    13     background-size: 100% 100%;
    15     background-size: 100% 100%;
    14     font-family: sans-serif;
    16     font-family: sans-serif;
    15 }
    17 }
    16 h1 { text-shadow: 0 0 2px white; }
    18 h1 { text-shadow: 0 0 2px white; color: black;}
    17 a 
    19 a 
    18 {
    20 {
    19     margin-top: 12px;
    21     margin-top: 12px;
    20     margin-left: 20px;
    22     margin-left: 20px;
    21     float: left;
    23     float: left;
    91 
    93 
    92     var resp = xml.responseText;
    94     var resp = xml.responseText;
    93     var r = />([^<]*).png</g;
    95     var r = />([^<]*).png</g;
    94     var x;
    96     var x;
    95     while(x = r.exec(resp)) 
    97     while(x = r.exec(resp)) 
    96         if (!/^Team|NoHat/.test(x[1])) // Exclude team coloured ones as repetitive, NoHat one as uninteresting
    98         if (!/NoHat|hair_team|cap_team|TeamTophat/.test(x[1])) // Exclude NoHat as uninteresting. hair_team, cap_team and TeamTophat as repetitive team hats
    97             masks.push(x[1]);
    99             masks.push(x[1]);
    98 
   100 
    99     var opt = document.createElement("option");
   101     var opt = document.createElement("option");
   100     opt.appendChild(document.createTextNode(""));
   102     opt.appendChild(document.createTextNode(""));
   101     var sel = document.body.appendChild(document.createElement("select"));
   103     var sel = document.body.appendChild(document.createElement("select"));
   103     for(var theme in themes)
   105     for(var theme in themes)
   104     {
   106     {
   105         sel.appendChild(opt.cloneNode(true));
   107         sel.appendChild(opt.cloneNode(true));
   106         sel.lastChild.value = theme;
   108         sel.lastChild.value = theme;
   107         sel.lastChild.lastChild.data = theme;
   109         sel.lastChild.lastChild.data = theme;
   108         if(theme == "Nature") sel.lastChild.selected = true;
   110         if(theme === "Nature") sel.lastChild.selected = true;
   109     }
   111     }
   110     var chk = document.createElement("input");
   112     var chk = document.createElement("input");
   111     chk.type = "checkbox";
   113     chk.type = "checkbox";
   112     chk.onclick = switchAnim;
   114     chk.onclick = switchAnim;
   113     document.body.appendChild(chk);
   115     document.body.appendChild(chk);
   114     chk = chk.cloneNode(false);
   116     chk = chk.cloneNode(false);
   115     chk.onclick = hideGirders;
   117     chk.onclick = hideGirders;
   116     document.body.appendChild(chk);
   118     document.body.appendChild(chk);
   117     var s = document.styleSheets[0].cssRules;
   119     var s = document.styleSheets[0].cssRules;
   118     for(var i=0;i<s.length;i++)
   120     for(var i=0;i<s.length;i++)
   119         if (s[i].selectorText.toLowerCase()==".girder") girder = s[i];
   121         if (s[i].selectorText.toLowerCase() === ".girder") girder = s[i];
   120         
   122         
   121     var a = document.createElement("a");
   123     var a = document.createElement("a");
   122     var g = document.createElement("div");
   124     var g = document.createElement("div");
   123     g.className="girder";
   125     g.className="girder";
   124     a.appendChild(document.createElement("div"));
   126     a.appendChild(document.createElement("div"));
   129         h.href = "//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Graphics/Hats/"+masks[i]+".png";
   131         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+'")';
   132         h.lastChild.style.backgroundImage = 'url("'+h.href+'")';
   131         h.lastChild.lastChild.data = masks[i];
   133         h.lastChild.lastChild.data = masks[i];
   132         h.title = masks[i];
   134         h.title = masks[i];
   133         h.idle = Math.floor(Math.random()*19);
   135         h.idle = Math.floor(Math.random()*19);
   134         if (i%17==16 || i==masks.length-1) document.body.appendChild(g.cloneNode(false));
   136         if (i%17 === 16 || i === masks.length-1) document.body.appendChild(g.cloneNode(false));
   135     }
   137     }
   136     
   138     
   137 /* quick and dirty animation */
   139 /* quick and dirty animation */
   138 animationInterval = setInterval(animateHogs, 128);
   140 animationInterval = setInterval(animateHogs, 128);
   139 }
   141 }
   182 //]]>
   184 //]]>
   183     </script>
   185     </script>
   184 </head>
   186 </head>
   185 <body>
   187 <body>
   186 <h1>List of Hedgewars hats</h1>
   188 <h1>List of Hedgewars hats</h1>
       
   189 <noscript>
       
   190 <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>
       
   191 <p>Normally, this webpage would display an animated preview of the hats in Hedgewars.</p>
       
   192 </noscript>
   187 </body>
   193 </body>
   188 </html>
   194 </html>