misc/hats_js_anim.xhtml
author sheepluva
Sat, 04 Jul 2020 03:11:41 +0200
changeset 15665 63e2b7b2ec47
parent 15568 de1b31c2d2f2
child 15977 f81fe8250ed9
permissions -rw-r--r--
Merge chat-scaling (= current state of branch "ui-scaling") into default branch
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; }
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
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
{
15565
ff58b2a18d85 Hats webpage: Remove protocol from URLs to fix CORS fail
Wuzzy <Wuzzy2@mail.ru>
parents: 15564
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
}
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    18
form, p
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    19
{
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    20
    background-color: #0B203D;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    21
    padding: 1em;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    22
    margin: 1em;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    23
    border-style: solid;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    24
    border-radius: 5px;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    25
    border-width: 2px;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    26
    border-color: #FFD902;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    27
}
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    28
h1 {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    29
    text-shadow: 0 0 2px white;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    30
    color: black;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    31
    margin:10px;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    32
}
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    33
a {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    34
    color: #BFBED0;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    35
    text-decoration: none;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    36
}
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    37
.hat
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
    38
{
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
    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
    40
    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
    41
    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
    42
    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
    43
    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
    44
    color: transparent;
15565
ff58b2a18d85 Hats webpage: Remove protocol from URLs to fix CORS fail
Wuzzy <Wuzzy2@mail.ru>
parents: 15564
diff changeset
    45
    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
    46
}
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
.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
    48
{
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
    49
    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
    50
    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
    51
    clear: left;
15565
ff58b2a18d85 Hats webpage: Remove protocol from URLs to fix CORS fail
Wuzzy <Wuzzy2@mail.ru>
parents: 15564
diff changeset
    52
    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
    53
    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
    54
}
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
.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
    56
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
    57
{
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
    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
    59
    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
    60
    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
    61
}
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
    </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
    63
    <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
    64
//<![CDATA[
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    65
var IS_LOCAL=false; // set to true to fetch hats locally. Useful for testing.
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    66
var masks;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    67
if (IS_LOCAL) {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    68
/* 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
    69
would be easier with a server-side portion. list of sprites could be gotten from server, but would require XSS whitelisting */
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    70
// Last updated: 1.0.0
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    71
masks = ['4gsuif','AkuAku','android','angel','anzac','Bandit','barrelhider','bb_bob','bb_bub','bb_cororon','bb_kululun','beefeater','beefeaterhat','bishop','bobby','bobby2v','bubble','bushhider','cap_blue','cap_green','cap_junior','cap_red','cap_thinking','cap_yellow','car','chef','chuckl','clown','clown-copper','clown-crossed','constructor','Coonskin3','Cowboy','cratehider','crown','cyborg1','cyborg2','cyclops','Dan','Dauber','DayAndNight','Disguise','dish_Ladle','dish_SauceBoatSilver','dish_Teacup','dish_Teapot','doctor','Dragon','dwarf','eastertop','Einstein','Elvis','Eva_00b','Eva_00y','Evil','flag_french','flag_germany','flag_italy','flag_usa','footballhelmet','fr_apple','fr_banana','fr_lemon','fr_orange','fr_pumpkin','fr_tomato','Gasmask','Glasses','hair_blue','hair_green','hair_grey','hair_orange','hair_pink','hair_purple','hair_red','hair_yellow','HogInTheHat','hogpharoah','IndianChief','InfernalHorns','Jason','jester','Joker','judo','kiss_criss','kiss_frehley','kiss_simmons','kiss_stanley','knight','lambda','lambdahat','Laminaria','lamp','laurel','leprechaun','mechanicaltoy','MegaHogX','metalband','Meteorhelmet','mexicansunbrero','mickey_ears','Moustache','Moustache_glasses','mp3','Mummy','mv_Spidey','mv_Venom','naruto','NinjaFull','NinjaStraight','NinjaTriangle','noface','ntd_Falcon','ntd_Kirby','ntd_Link','ntd_Samus','nurse','nursehat','OldMan','Pantsu','pinksunhat','pirate_bandana','pirate_eyepatch','pirate_hat','pirate_jack','pirate_jack_bandana','Plunger',
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    72
'poke_ash','poke_ash_hat','poke_charmander','poke_chikorita','poke_diglett','poke_jigglypuff','poke_lugia','poke_mudkip','poke_pikachu','poke_slowpoke','poke_squirtle','poke_voltorb','policecap','policegirl','punkman','quotecap','Rain','Rambo','RamboClean','rasta','RobinHood','royalguard','RSR','Samurai','Santa','scif_2001O','scif_2001Y','scif_BrainSlug','scif_BrainSlug2','scif_cosmonaut','scif_cyberpunk','scif_Geordi','scif_SparkssHelmet','scif_swDarthvader','scif_swStormtrooper','sf_balrog','sf_blanka','sf_blankatoothless','sf_chunli','sf_guile','sf_guile_hat','sf_honda','sf_ken','sf_ryu','sf_vega','sf_vega_hat','ShaggyYeti','ShortHair_Black','ShortHair_Brown','ShortHair_Grey','ShortHair_Red','ShortHair_Yellow','simple_green','simple_red','simple_yellow','Skull','Sleepwalker','sm_daisy','sm_luigi','sm_mario','sm_peach','sm_toad','sm_wario','Sniper','snorkel','snowhog','SparkleSuperFun','spartan','spcartman','spkenny','spkyle','spstan','sth_Amy','sth_AmyClassic','sth_Eggman','sth_Knux','sth_Metal','sth_Shadow','sth_Sonic','sth_SonicClassic','sth_Super','sth_Tails','stormcloud',
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    73
'StrawHat','StrawHatEyes','StrawHatFacial','Sunglasses','SunWukong','swordsmensquire','TeamHeadband','TeamSoldier','TeamWheatley','Terminator_Glasses','tf_demoman','tf_scout','thug','thugclean','tiara','tophats','touhou_chen','touhou_marisa','touhou_patchouli','touhou_remelia','touhou_suwako','touhou_yukari','ushanka','vampirichog','vc_gakupo','vc_gumi','vc_kaito','vc_len','vc_luka','vc_meiko','vc_miku','vc_rin','Viking','war_airwarden02','war_airwarden03','war_americanww2helmet','war_britmedic','war_britpthhelmet','war_britsapper','war_desertgrenadier1','war_desertgrenadier2','war_desertgrenadier4','war_desertgrenadier5','war_desertmedic','war_desertofficer','war_desertsapper1','war_desertsapper2','war_frenchww1gasmask','war_frenchww1helmet','war_germanww1helmet2','war_germanww1tankhelm','war_germanww2medic','war_germanww2pith','war_grenadier1','war_plainpith','war_sovietcomrade1','war_sovietcomrade2','war_trenchfrench01','war_trenchfrench02','war_trenchgrenadier1','war_trenchgrenadier2','war_trenchgrenadier3','war_UNPeacekeeper01','war_UNPeacekeeper02','WhySoSerious','WizardHat','Zombi','zoo_Bat','zoo_Beaver','zoo_Bunny','zoo_chicken','zoo_crocodile','zoo_Deer','zoo_elephant','zoo_fish','zoo_frog','zoo_Hedgehog','zoo_Moose','zoo_octopus','zoo_Pig','zoo_Porkey','zoo_Sheep','zoo_snail','zoo_turtle'
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    74
,'NoHat','cap_team','hair_team','TeamTophat'
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    75
];
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    76
}
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    77
else
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    78
{
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    79
masks = [];
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    80
}
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    81
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 themes = {
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    83
// Last updated: 1.0.0
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    84
"Art":1,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    85
"Beach":1,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    86
"Bamboo":1,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    87
"Bath":1,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    88
//"Blox":0, //unused, has no Sky.png or Border.png
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    89
"Brick":0,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    90
"Cake":0,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    91
"Castle":1,
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
    92
"Cave":1,
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    93
"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
    94
"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
    95
"Christmas":1,
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    96
"Compost":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
    97
"CrazyMission":0,
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    98
"Deepspace":0,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
    99
"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
   100
"EarthRise":0,
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   101
"Eyes":0,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   102
"Freeway":0,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   103
"Fruit":1,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   104
"Halloween":1,
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   105
"Hell":0,
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   106
"Hoggywood":1,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   107
"Island":0,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   108
"Jungle":1,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   109
"Golf":1,
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   110
"Nature":1,
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   111
"Olympics":1,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   112
"Planes":0,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   113
"Sheep":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
   114
"Snow":1,
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   115
"Stage":1,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   116
"Underwater":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
   117
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
   118
var animationInterval;
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   119
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   120
var staticMasks = [];
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   121
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   122
on_xml_loaded = function(ex)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   123
{
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   124
    var resp = this.responseText;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   125
    var r = />([^<]*).png</g;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   126
    var x;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   127
    while(x = r.exec(resp))
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   128
    {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   129
        masks.push(x[1]);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   130
    }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   131
    on_hats_loaded();
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   132
}
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   133
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   134
on_xml_error = function()
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   135
{
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   136
    var p = document.createElement("p");
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   137
    p.appendChild(document.createTextNode("ERROR: List of hats could not be fetched from the server!"));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   138
    document.body.appendChild(p);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   139
}
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   140
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
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
   142
{
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   143
    // Load list of hats
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   144
    if (!IS_LOCAL) {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   145
        // Request list of hats from repository URL
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   146
        var xml=new XMLHttpRequest();
15565
ff58b2a18d85 Hats webpage: Remove protocol from URLs to fix CORS fail
Wuzzy <Wuzzy2@mail.ru>
parents: 15564
diff changeset
   147
        xml.open("GET", "//hg.hedgewars.org/hedgewars/file/tip/share/hedgewars/Data/Graphics/Hats/");
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   148
        xml.addEventListener("error", on_xml_error);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   149
        xml.onload = on_xml_loaded;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   150
        xml.send();
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   151
    }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   152
    else
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   153
    {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   154
        on_hats_loaded();
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   155
    }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   156
}
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   157
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   158
on_hats_loaded = function()
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   159
{
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   160
    // Exclude NoHat as uninteresting. Exclude team hats as we can't properly display them yet
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   161
    // TODO: Add support for team hats
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   162
    var disallowedMasks = {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   163
        "NoHat":true,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   164
        "hair_team":true,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   165
        "cap_team":true,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   166
        "TeamTophat":true,
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   167
    };
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   168
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   169
    // Render girders
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   170
    var s = document.styleSheets[0].cssRules;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   171
    for(var i=0;i<s.length;i++)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   172
    {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   173
        if (s[i].selectorText.toLowerCase() === ".girder")
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   174
            girder = s[i];
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   175
    }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   176
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   177
    var a = document.createElement("a");
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   178
    var g = document.createElement("div");
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   179
    g.className="girder";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   180
    a.className="hat";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   181
    a.appendChild(document.createElement("div"));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   182
    a.lastChild.appendChild(document.createTextNode(""));
5778
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
   183
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   184
    // Render hats
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   185
    var missingMasks = [];
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   186
    var img;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   187
    var j = 0;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   188
    var toDelete = [];
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   189
    for (var i=0;i<masks.length;i++)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   190
    {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   191
        if (disallowedMasks[masks[i]] === true) {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   192
            missingMasks.push(masks[i]);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   193
            toDelete.push(i);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   194
            continue;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   195
        }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   196
        var h = document.body.appendChild(a.cloneNode(true));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   197
        if (IS_LOCAL)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   198
            h.href = "../share/hedgewars/Data/Graphics/Hats/"+masks[i]+".png";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   199
        else
15565
ff58b2a18d85 Hats webpage: Remove protocol from URLs to fix CORS fail
Wuzzy <Wuzzy2@mail.ru>
parents: 15564
diff changeset
   200
            h.href = "//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Graphics/Hats/"+masks[i]+".png";
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   201
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   202
        img = new Image();
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   203
        img.onload = function() {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   204
            var name = this.id.substr(7);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   205
            if (this.height === 32) {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   206
                staticMasks[name] = true;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   207
            }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   208
            this.remove();
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   209
        }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   210
        img.src = h.href;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   211
        img.id = "__mask_"+masks[i];
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   212
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   213
        h.lastChild.style.backgroundImage = 'url("'+h.href+'")';
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   214
        h.lastChild.lastChild.data = masks[i];
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   215
        h.title = masks[i];
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   216
        h.idle = Math.floor(Math.random()*19);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   217
        if (j%17 === 16 || i === masks.length-1)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   218
            document.body.appendChild(g.cloneNode(false));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   219
        j++;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   220
    }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   221
    // Cleanup masks array
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   222
    for (var i=0; i<toDelete.length; i++)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   223
        masks.splice(toDelete[i], 1);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   224
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   225
    // List missing hats
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   226
    if (missingMasks.length > 0)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   227
    {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   228
        var pm = document.createElement("p");
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   229
        pm.appendChild(document.createTextNode("Other hats: "));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   230
        for (var i=0; i<missingMasks.length; i++)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   231
        {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   232
            if (missingMasks[i] === "NoHat")
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   233
                continue;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   234
            var link = document.createElement("a");
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   235
            if (IS_LOCAL)
15566
909ef1f3ef19 Hats webpage: Fix "other hats" section listing wrong hats
Wuzzy <Wuzzy2@mail.ru>
parents: 15565
diff changeset
   236
                link.href = "../share/hedgewars/Data/Graphics/Hats/"+missingMasks[i]+".png";
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   237
            else
15566
909ef1f3ef19 Hats webpage: Fix "other hats" section listing wrong hats
Wuzzy <Wuzzy2@mail.ru>
parents: 15565
diff changeset
   238
                link.href = "//hg.hedgewars.org/hedgewars/raw-file/tip/share/hedgewars/Data/Graphics/Hats/"+missingMasks[i]+".png";
909ef1f3ef19 Hats webpage: Fix "other hats" section listing wrong hats
Wuzzy <Wuzzy2@mail.ru>
parents: 15565
diff changeset
   239
            link.appendChild(document.createTextNode(missingMasks[i]));
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   240
            pm.appendChild(link);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   241
            if (i < missingMasks.length -1)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   242
                pm.appendChild(document.createTextNode(", "));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   243
        }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   244
        document.body.appendChild(pm);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   245
    }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   246
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   247
    // Quick and dirty animation
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   248
    animationInterval = setInterval(animateHogs, 128);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   249
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   250
    // Theme selection drop-down list
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   251
    var form = document.body.appendChild(document.createElement("form"));
5778
45fe3fa062b1 Load list of hats dynamically.
nemo
parents: 5763
diff changeset
   252
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
   253
    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
   254
    opt.appendChild(document.createTextNode(""));
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   255
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   256
    var label = document.createElement("label");
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   257
    label.htmlFor = "theme_select";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   258
    label.appendChild(document.createTextNode("Theme: "));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   259
    form.appendChild(label);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   260
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   261
    var sel = form.appendChild(document.createElement("select"));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   262
    sel.id = "theme_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
   263
    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
   264
    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
   265
    {
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
   266
        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
   267
        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
   268
        sel.lastChild.lastChild.data = theme;
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   269
        if(theme === "Nature")
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   270
            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
   271
    }
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   272
    form.appendChild(document.createElement("br"));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   273
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   274
    // Checkbox: Switch animation
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
   275
    var chk = document.createElement("input");
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   276
    chk.id = "anim";
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
   277
    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
   278
    chk.onclick = switchAnim;
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   279
    chk.checked = true;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   280
    form.appendChild(chk);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   281
    label = document.createElement("label");
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   282
    label.htmlFor = "anim";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   283
    label.appendChild(document.createTextNode("Animate hats"));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   284
    form.appendChild(label);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   285
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   286
    form.appendChild(document.createElement("br"));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   287
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   288
    // Checkbox: Hide girders
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   289
    chk = document.createElement("input");
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   290
    chk.id = "hide_girders";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   291
    chk.type = "checkbox";
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
   292
    chk.onclick = hideGirders;
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   293
    chk.checked = true;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   294
    form.appendChild(chk);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   295
    label = document.createElement("label");
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   296
    label.htmlFor = "hide_girders";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   297
    label.appendChild(document.createTextNode("Show girders"));
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   298
    form.appendChild(label);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   299
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   300
    document.body.appendChild(form);
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   301
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   302
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
   303
}
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
   304
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
   305
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
   306
{
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
   307
    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
   308
    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
   309
    {
15567
f22ebcd9f3fc Hats webpage: Fix incorrect check for static hat
Wuzzy <Wuzzy2@mail.ru>
parents: 15566
diff changeset
   310
        if (a[i].className !== "hat")
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   311
            continue;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   312
        // Cycle through hedgehog and hat animation frames
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   313
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   314
        // Hedgehog
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
   315
        a[i].style.backgroundPosition=Math.floor(a[i].idle/16)*-32+"px "+(a[i].idle%16)*-32+"px";
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   316
15568
de1b31c2d2f2 Hats webpage: Fix another incorrect static hat check
Wuzzy <Wuzzy2@mail.ru>
parents: 15567
diff changeset
   317
        var maskName = a[i].title;
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   318
        // Hat
15568
de1b31c2d2f2 Hats webpage: Fix another incorrect static hat check
Wuzzy <Wuzzy2@mail.ru>
parents: 15567
diff changeset
   319
        if (staticMasks[maskName] === true) {
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   320
            // Hat offset for static hats
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   321
            if (a[i].idle === 2 || a[i].idle === 7 || a[i].idle === 12)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   322
                a[i].firstChild.style.marginTop="-4px";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   323
            else if (a[i].idle === 16)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   324
                a[i].firstChild.style.marginTop="-6px";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   325
            else
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   326
                a[i].firstChild.style.marginTop="-5px";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   327
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   328
            a[i].firstChild.style.backgroundPosition="0px 0px";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   329
        }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   330
        else
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   331
        {
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   332
            // Animated hat frames
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   333
            a[i].firstChild.style.backgroundPosition=Math.floor(a[i].idle/16)*-32+"px "+(a[i].idle%16)*-32+"px";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   334
        }
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   335
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   336
        // Next frame
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
   337
        a[i].idle++;
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   338
        if (a[i].idle > 18)
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   339
            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
   340
    }
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
   341
}
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
   342
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   343
// Turn on or off hog+hat animation
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
   344
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
   345
{
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   346
    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
   347
    {
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
   348
        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
   349
        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
   350
    }
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
   351
    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
   352
}
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
   353
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   354
// Turn on or off girders
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
   355
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
   356
{
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
   357
    var g = document.getElementsByClassName("girder");
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   358
    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
   359
        if (this.checked)
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   360
            g[i].className = "girder";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   361
        else
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   362
            g[i].className = "girder hide";
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   363
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
   364
}
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
   365
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   366
// Select theme according to drop-down list value
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
   367
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
   368
{
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   369
    var prefix;
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   370
    if (!IS_LOCAL)
15565
ff58b2a18d85 Hats webpage: Remove protocol from URLs to fix CORS fail
Wuzzy <Wuzzy2@mail.ru>
parents: 15564
diff changeset
   371
        prefix = "//hg.hedgewars.org/hedgewars/raw-file/tip";
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   372
    else
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   373
        prefix = "..";
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   374
    document.body.style.backgroundImage='url("'+prefix+'/share/hedgewars/Data/Themes/'+this.value+'/Sky.png")';
15563
af4bcdbf2c8f Backed out changesets 799fd0a6d3bf+3c1c5ff824f7
Wuzzy <Wuzzy2@mail.ru>
parents: 15562
diff changeset
   375
    if (themes[this.value])
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   376
        girder.style.backgroundImage='url("'+prefix+'/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
   377
    else
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   378
        girder.style.backgroundImage='url("'+prefix+'/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
   379
}
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
   380
//]]>
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
   381
    </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
   382
</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
   383
<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
   384
<h1>List of Hedgewars hats</h1>
13409
697aaee36684 Add <noscript> fallback for hats preview webpage
Wuzzy <Wuzzy2@mail.ru>
parents: 12927
diff changeset
   385
<noscript>
15564
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   386
<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.<br/>
732b82f44c83 Hats webpage: Many improvements and fixes (2nd try)
Wuzzy <Wuzzy2@mail.ru>
parents: 15563
diff changeset
   387
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
   388
</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
   389
</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
   390
</html>