misc/hats_js_anim.xhtml
author Wuzzy <Wuzzy2@mail.ru>
Sat, 16 May 2020 01:18:34 +0200
changeset 15563 af4bcdbf2c8f
parent 15562 799fd0a6d3bf
child 15564 732b82f44c83
permissions -rw-r--r--
Backed out changesets 799fd0a6d3bf+3c1c5ff824f7 Sadly, the update did not work when hosted online. :-(
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; }
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
     9
body 
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
    10
{
15562
799fd0a6d3bf Hats webpage: Fix URLs
Wuzzy <Wuzzy2@mail.ru>
parents: 15561
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
}
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    18
h1 { text-shadow: 0 0 2px white; color: black;}
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    19
a 
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
    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;
15562
799fd0a6d3bf Hats webpage: Fix URLs
Wuzzy <Wuzzy2@mail.ru>
parents: 15561
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;
15562
799fd0a6d3bf Hats webpage: Fix URLs
Wuzzy <Wuzzy2@mail.ru>
parents: 15561
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[
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    47
/* javascript version of a sprite sheet - this could be pretty trivially done in pure HTML, but maintenance
13507
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 */
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
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'];*/
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
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 = {
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    52
"Cave":1,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    53
"Golf":1,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    54
"Stage":1,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    55
"Island":0,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    56
"Eyes":0,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    57
"Deepspace":0,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    58
"Jungle":1,
15561
3c1c5ff824f7 Many improvements and fixes for hats webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 13507
diff changeset
    59
"Cake":0,
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    60
"Compost":1,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    61
"Planes":0,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    62
"Olympics":1,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    63
"Bath":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
    64
"Cheese":0,
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    65
"Desert":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
    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,
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    68
"Sheep":1,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    69
"Brick":0,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    70
"Underwater":1,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    71
"City":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
    72
"EarthRise":0,
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    73
"Blox":0,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    74
"Hell":0,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    75
"Bamboo":1,
15561
3c1c5ff824f7 Many improvements and fixes for hats webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 13507
diff changeset
    76
"Freeway":0,
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    77
"Nature":1,
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    78
"Art":1,
15561
3c1c5ff824f7 Many improvements and fixes for hats webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 13507
diff changeset
    79
"Halloween":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
    80
"Snow":1,
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    81
"Castle":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
    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
{
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    86
    var xml=new XMLHttpRequest();
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    87
    xml.open("GET", "/hedgewars/file/tip/share/hedgewars/Data/Graphics/Hats/", false);
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    88
    xml.send(null);
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    89
    /*var resp = xml.responseXML; unfortunately not served as XHTML
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    90
    var a = resp.getElementsByTagName("a");
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    91
    for(var i=0;i<a.length;i++);
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    92
        if (/\.png/.test(a[0].href)) m.push(a[0].replace(/.png/,''));*/
5778
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
    93
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    94
    var resp = xml.responseText;
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    95
    var r = />([^<]*).png</g;
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    96
    var x;
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    97
    while(x = r.exec(resp)) 
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
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
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
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(""));
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   103
    var sel = document.body.appendChild(document.createElement("select"));
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
   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;
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
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;
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   115
    document.body.appendChild(chk);
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   116
    chk = chk.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
   117
    chk.onclick = hideGirders;
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   118
    document.body.appendChild(chk);
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   119
    var s = document.styleSheets[0].cssRules;
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   120
    for(var i=0;i<s.length;i++)
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   121
        if (s[i].selectorText.toLowerCase() === ".girder") girder = s[i];
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   122
        
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   123
    var a = document.createElement("a");
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   124
    var g = document.createElement("div");
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   125
    g.className="girder";
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   126
    a.appendChild(document.createElement("div"));
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   127
    a.lastChild.appendChild(document.createTextNode(""));
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   128
    for (var i=0;i<masks.length;i++)
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   129
    {
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   130
        var h = document.body.appendChild(a.cloneNode(true));
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   131
        h.href = "//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Graphics/Hats/"+masks[i]+".png";
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   132
        h.lastChild.style.backgroundImage = 'url("'+h.href+'")';
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   133
        h.lastChild.lastChild.data = masks[i];
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   134
        h.title = masks[i];
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   135
        h.idle = Math.floor(Math.random()*19);
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   136
        if (i%17 === 16 || i === masks.length-1) document.body.appendChild(g.cloneNode(false));
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   137
    }
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   138
    
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   139
/* quick and dirty animation */
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   140
animationInterval = setInterval(animateHogs, 128);
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
   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";
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   149
        a[i].firstChild.style.backgroundPosition=Math.floor(a[i].idle/16)*-32+"px "+(a[i].idle%16)*-32+"px";
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
   150
        a[i].idle++;
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   151
        if (a[i].idle > 18) a[i].idle = 0;
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
   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
{
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   157
    if (animationInterval) 
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
   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");
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   168
    for(var i=0;i<g.length;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
   169
        if (this.checked)
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   170
            g[i].className = "girder hide";
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   171
        else
15561
3c1c5ff824f7 Many improvements and fixes for hats webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 13507
diff changeset
   172
            g[i].className = "girder";
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   173
    
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
   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
{
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   178
    document.body.style.backgroundImage='url("//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Themes/'+this.value+'/Sky.png")';
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   179
    if (themes[this.value])
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   180
        girder.style.backgroundImage='url("//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Themes/'+this.value+'/Girder.png")';
15561
3c1c5ff824f7 Many improvements and fixes for hats webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 13507
diff changeset
   181
    else
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
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>
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
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>
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   191
<p>Normally, this webpage would display an animated preview of the hats in Hedgewars.</p>
13409
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>