misc/hats_js_anim.xhtml
author nemo
Mon, 12 Sep 2022 18:36:39 -0400
branch1.0.0
changeset 15890 39051294d1fb
parent 13513 7e188a28f078
child 15583 3c1c5ff824f7
permissions -rw-r--r--
I keep forgetting to bump the patch version
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
     1
<!DOCTYPE HTML>
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
     2
<html xmlns="http://www.w3.org/1999/xhtml">
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
     3
<head>
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
     4
<!-- There is, at present, no official xsd for (X)HTML5. A pity. Usefulness would depend on the parser and extensions made by the site.  -->
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
     5
    <title>Hedgewars Hats</title>
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
     6
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
     7
    <style type="text/css">
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
     8
* {padding: 0; margin: 0; }
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
     9
body 
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    10
{
11877
95a3041aadb9 fix urls
nemo
parents: 6936
diff changeset
    11
    background: url('//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Themes/Nature/Sky.png') fixed no-repeat bottom left;
13410
7487e683c6b6 More fallback styling for hat preview webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 13409
diff changeset
    12
    background-color: #0B203D;
7487e683c6b6 More fallback styling for hat preview webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 13409
diff changeset
    13
    color: #FFD902;
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    14
    -moz-background-size: 200%;
6419
6a464d0a5c13 Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
nemo
parents: 5779
diff changeset
    15
    background-size: 100% 100%;
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    16
    font-family: sans-serif;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    17
}
13410
7487e683c6b6 More fallback styling for hat preview webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 13409
diff changeset
    18
h1 { text-shadow: 0 0 2px white; color: black;}
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    19
a 
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    20
{
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    21
    margin-top: 12px;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    22
    margin-left: 20px;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    23
    float: left;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    24
    height: 32px;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    25
    width: 32px;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    26
    color: transparent;
11877
95a3041aadb9 fix urls
nemo
parents: 6936
diff changeset
    27
    background-image: url("//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Graphics/Hedgehog/Idle.png");
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    28
}
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    29
.girder
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    30
{
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    31
    width: 100%;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    32
    height: 30px;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    33
    clear: left;
11877
95a3041aadb9 fix urls
nemo
parents: 6936
diff changeset
    34
    background-image: url('//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Themes/Nature/Girder.png');
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    35
    background-repeat: repeat-x;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    36
}
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    37
.hide { visibility: hidden; }
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    38
a div
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    39
{
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    40
    margin-top: -5px;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    41
    height: 32px;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    42
    width: 32px;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    43
}
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    44
    </style>
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    45
    <script type="application/ecmascript">
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    46
//<![CDATA[
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    47
/* javascript version of a sprite sheet - this could be pretty trivially done in pure HTML, but maintenance
13513
7e188a28f078 Remove and replace old googlecode references
Wuzzy <Wuzzy2@mail.ru>
parents: 13410
diff changeset
    48
would be easier with a server-side portion. list of sprites could be gotten from server, but would require XSS whitelisting */
5778
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    49
/*var masks = ['2001suit2', '2001suit', '4gsuif', 'AkuAku', 'android', 'angel', 'anzac', 'apple', 'ash', 'Balrog', 'banana', 'Bandit', 'bat', 'beaver', 'beefeater', 'Blanka', 'BlankaToothless', 'BlueCap', 'BlueHair', 'bobby2v', 'bobby', 'Bob', 'BrainSlugMouth', 'BrainSlug', 'britishpithhelmet', 'britmedic', 'britsapper', 'Bub', 'Bunny', 'bushhider', 'charlesdegaulle', 'charmander', 'chef', 'chikorita', 'Chunli', 'clown-copper', 'clown-crossed', 'clown', 'Coonskin3', 'Cororon', 'Cowboy', 'crown', 'cyborg', 'darthvader', 'Deer', 'desertgrenadier01', 'desertgrenadier02', 'desertgrenadier04', 'desertgrenadier05', 'desertgrenadierofficer', 'desertmedic', 'desertsapper1', 'desertsapper2', 'diglett', 'Disguise', 'Dragon', 'dwarf', 'eastertop', 'Elvis', 'Eva_00b', 'Eva_00y', 'Falcon', 'frenchwwigasmask', 'frenchwwihelmet', 'Gasmask', 'Geordi', 'germanwiimedichelmet', 'germanwwihelmetmustache', 'germanwwiipithhelmetdes', 'germanwwitankhelmet', 'Glasses', 'GreenCap', 'GreenHair', 'grenadier1', 'GreyHair', 'Guile', 'hedgehogk', 'HogInTheHat', 'hogpharoah', 'Honda', 'IndianChief', 'infernalhorns', 'InfernalHorns', 'Jason', 'jigglypuff', 'judo', 'junior', 'Ken', 'KirbyMask', 'kiss_criss', 'kiss_frehley', 'kiss_simmons', 'kiss_stanley', 'knight', 'Kululun', 'Ladle', 'lambda', 'Laminaria', 'laurel', 'lemon', 'link', 'lugia', 'Luigi', 'Mario', 'MegaHogX', 'metalband', 'mexicansunbrero', 'mickey_ears', 'Moose', 'mp3', 'mudkip', 'Mummy', 'naruto', 'NinjaFull', 'NinjaStraight', 'NinjaTriangle', 'OldMan', 'OrangeHair', 'orange', 'Pantsu', 'Pig', 'pikachu', 'PinkHair', 'pinksunhat', 'pirate_jack_bandana', 'pirate_jack', 'plainpith', 'Plunger', 'policecap', 'porkey', 'PrincessDaisy', 'PrincessPeach', 'Pumpkin_Hat', 'PurpleHair', 'quotecap', 'Rain', 'Rambo', 'rasta', 'RedCap', 'RedHair', 'RobinHood', 'royalguard', 'RSR', 'Ryu', 'Samurai', 'Samus', 'Santa', 'SauceBoatSilver', 'ShaggyYeti', 'sheep', 'ShortHair_Black', 'ShortHair_Brown', 'ShortHair_Grey', 'ShortHair_Red', 'ShortHair_Yellow', 'Skull', 'Sleepwalker', 'slowpoke', 'Sniper', 'Sonic', 'sovietcomrade2', 'sovietcomrade', 'SparkleSuperFun', 'SparkssHelmet', 'spartan', 'spcartman', 'spidey', 'spkenny', 'spkyle', 'spstan', 'squirtle', 'sth_AmyClassic', 'sth_Amy', 'sth_Eggman', 'sth_Knux', 'sth_Metal', 'sth_Shadow', 'sth_Sonic', 'sth_Super', 'sth_Tails', 'stormcloud', 'stormtrooper', 'StrawHatEyes', 'StrawHatFacial', 'StrawHat', 'Sunglasses', 'SunWukong', 'Teacup', 'Teapot', 'terminatorc', 'Terminator_Glasses', 'thug', 'Toad', 'tophats', 'touhou_chen', 'touhou_marisa', 'touhou_patchouli', 'touhou_remelia', 'touhou_suwako', 'touhou_yukari', 'trenchgrenadier1', 'trenchgrenadier2', 'trenchgrenadier3', 'ushanka', 'vampirichog', 'Vega', 'venom', 'Viking', 'voltorb', 'Wario', 'WhySoSerious', 'WizardHat', 'YellowCap', 'YellowHair', 'Zombi'];*/
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    50
var masks = [];
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    51
var themes = {
6936
8af2bf10ee62 theme tweaks
nemo
parents: 6419
diff changeset
    52
"Cave":1,
5778
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    53
"Golf":1,
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    54
"Stage":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    55
"Island":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    56
"Eyes":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    57
"Deepspace":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    58
"Jungle":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    59
"Cake":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    60
"Compost":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    61
"Planes":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    62
"Olympics":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    63
"Bath":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    64
"Cheese":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    65
"Desert":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    66
"Christmas":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    67
"CrazyMission":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    68
"Sheep":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    69
"Brick":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    70
"Underwater":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    71
"City":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    72
"EarthRise":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    73
"Blox":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    74
"Hell":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    75
"Bamboo":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    76
"Freeway":0,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    77
"Nature":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    78
"Art":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    79
"Halloween":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    80
"Snow":1,
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    81
"Castle":1};
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    82
var girder;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    83
var animationInterval;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    84
window.onload = function()
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
    85
{
5778
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    86
    var xml=new XMLHttpRequest();
11877
95a3041aadb9 fix urls
nemo
parents: 6936
diff changeset
    87
    xml.open("GET", "/hedgewars/file/tip/share/hedgewars/Data/Graphics/Hats/", false);
5778
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    88
    xml.send(null);
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    89
    /*var resp = xml.responseXML; unfortunately not served as XHTML
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    90
    var a = resp.getElementsByTagName("a");
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    91
    for(var i=0;i<a.length;i++);
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    92
        if (/\.png/.test(a[0].href)) m.push(a[0].replace(/.png/,''));*/
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    93
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    94
    var resp = xml.responseText;
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    95
    var r = />([^<]*).png</g;
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    96
    var x;
5779
060d7572f9f6 Move a few more, exclude NoHat and team hats from animation
nemo
parents: 5778
diff changeset
    97
    while(x = r.exec(resp)) 
12927
9400a272c88f Change hats exclusion rule in hats_js_anim.xhtml
Wuzzy <Wuzzy2@mail.ru>
parents: 11877
diff changeset
    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
5779
060d7572f9f6 Move a few more, exclude NoHat and team hats from animation
nemo
parents: 5778
diff changeset
    99
            masks.push(x[1]);
5778
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
   100
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   101
    var opt = document.createElement("option");
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   102
    opt.appendChild(document.createTextNode(""));
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   103
    var sel = document.body.appendChild(document.createElement("select"));
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   104
    sel.onchange = switchTheme;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   105
    for(var theme in themes)
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   106
    {
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   107
        sel.appendChild(opt.cloneNode(true));
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   108
        sel.lastChild.value = theme;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   109
        sel.lastChild.lastChild.data = theme;
13409
697aaee36684 Add <noscript> fallback for hats preview webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 12927
diff changeset
   110
        if(theme === "Nature") sel.lastChild.selected = true;
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   111
    }
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   112
    var chk = document.createElement("input");
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   113
    chk.type = "checkbox";
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   114
    chk.onclick = switchAnim;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   115
    document.body.appendChild(chk);
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   116
    chk = chk.cloneNode(false);
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   117
    chk.onclick = hideGirders;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   118
    document.body.appendChild(chk);
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   119
    var s = document.styleSheets[0].cssRules;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   120
    for(var i=0;i<s.length;i++)
13409
697aaee36684 Add <noscript> fallback for hats preview webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 12927
diff changeset
   121
        if (s[i].selectorText.toLowerCase() === ".girder") girder = s[i];
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   122
        
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   123
    var a = document.createElement("a");
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   124
    var g = document.createElement("div");
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   125
    g.className="girder";
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   126
    a.appendChild(document.createElement("div"));
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   127
    a.lastChild.appendChild(document.createTextNode(""));
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   128
    for (var i=0;i<masks.length;i++)
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   129
    {
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   130
        var h = document.body.appendChild(a.cloneNode(true));
11877
95a3041aadb9 fix urls
nemo
parents: 6936
diff changeset
   131
        h.href = "//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Graphics/Hats/"+masks[i]+".png";
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   132
        h.lastChild.style.backgroundImage = 'url("'+h.href+'")';
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   133
        h.lastChild.lastChild.data = masks[i];
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   134
        h.title = masks[i];
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   135
        h.idle = Math.floor(Math.random()*19);
13409
697aaee36684 Add <noscript> fallback for hats preview webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 12927
diff changeset
   136
        if (i%17 === 16 || i === masks.length-1) document.body.appendChild(g.cloneNode(false));
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   137
    }
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   138
    
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   139
/* quick and dirty animation */
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   140
animationInterval = setInterval(animateHogs, 128);
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   141
}
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   142
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   143
function animateHogs()
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   144
{
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   145
    var a = document.getElementsByTagName("a");
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   146
    for (var i=0;i<a.length;i++)
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   147
    {
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   148
        a[i].style.backgroundPosition=Math.floor(a[i].idle/16)*-32+"px "+(a[i].idle%16)*-32+"px";
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   149
        a[i].firstChild.style.backgroundPosition=Math.floor(a[i].idle/16)*-32+"px "+(a[i].idle%16)*-32+"px";
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   150
        a[i].idle++;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   151
        if (a[i].idle > 18) a[i].idle = 0;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   152
    }
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   153
}
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   154
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   155
function switchAnim()
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   156
{
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   157
    if (animationInterval) 
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   158
    {
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   159
        clearInterval(animationInterval);
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   160
        animationInterval = null;
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   161
    }
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   162
    else animationInterval = setInterval(animateHogs, 128);
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   163
}
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   164
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   165
function hideGirders()
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   166
{
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   167
    var g = document.getElementsByClassName("girder");
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   168
    for(var i=0;i<g.length;i++) 
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   169
        if (this.checked)
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   170
            g[i].className = "girder hide";
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   171
        else
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   172
            g[i].className = "girder";
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   173
    
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   174
}
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   175
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   176
function switchTheme()
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   177
{
11877
95a3041aadb9 fix urls
nemo
parents: 6936
diff changeset
   178
    document.body.style.backgroundImage='url("//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Themes/'+this.value+'/Sky.png")';
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   179
    if (themes[this.value])
11877
95a3041aadb9 fix urls
nemo
parents: 6936
diff changeset
   180
        girder.style.backgroundImage='url("//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Themes/'+this.value+'/Girder.png")';
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   181
    else
11877
95a3041aadb9 fix urls
nemo
parents: 6936
diff changeset
   182
        girder.style.backgroundImage='url("//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Graphics/Girder.png")';
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   183
}
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   184
//]]>
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   185
    </script>
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   186
</head>
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   187
<body>
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   188
<h1>List of Hedgewars hats</h1>
13409
697aaee36684 Add <noscript> fallback for hats preview webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 12927
diff changeset
   189
<noscript>
697aaee36684 Add <noscript> fallback for hats preview webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 12927
diff changeset
   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>
697aaee36684 Add <noscript> fallback for hats preview webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 12927
diff changeset
   191
<p>Normally, this webpage would display an animated preview of the hats in Hedgewars.</p>
697aaee36684 Add <noscript> fallback for hats preview webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 12927
diff changeset
   192
</noscript>
5071
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   193
</body>
0b931e96bee9 Adding a hat test page to version control. Also kind of a test to see if it will be served with the right content type by google code
nemo
parents:
diff changeset
   194
</html>