misc/hats_js_anim.xhtml
branchhedgeroid
changeset 5824 2e5835130d9a
parent 5779 060d7572f9f6
child 6419 6a464d0a5c13
equal deleted inserted replaced
5733:5ab22736bdb6 5824:2e5835130d9a
    10 {
    10 {
    11     background: url('http://hedgewars.googlecode.com/hg/share/hedgewars/Data/Themes/Nature/Sky.png') fixed no-repeat bottom left;
    11     background: url('http://hedgewars.googlecode.com/hg/share/hedgewars/Data/Themes/Nature/Sky.png') fixed no-repeat bottom left;
    12     -moz-background-size: 200%;
    12     -moz-background-size: 200%;
    13     background-size: 200%;
    13     background-size: 200%;
    14     font-family: sans-serif;
    14     font-family: sans-serif;
    15     overflow: hidden;
       
    16 }
    15 }
    17 h1 { text-shadow: 0 0 2px white; }
    16 h1 { text-shadow: 0 0 2px white; }
    18 a 
    17 a 
    19 {
    18 {
    20     margin-top: 12px;
    19     margin-top: 12px;
    43     </style>
    42     </style>
    44     <script type="application/ecmascript">
    43     <script type="application/ecmascript">
    45 //<![CDATA[
    44 //<![CDATA[
    46 /* javascript version of a sprite sheet - this could be pretty trivially done in pure HTML, but maintenance
    45 /* javascript version of a sprite sheet - this could be pretty trivially done in pure HTML, but maintenance
    47 would be easier with a server-side portion. list of sprites could be gotten from googlecode, but would require XSS whitelisting */
    46 would be easier with a server-side portion. list of sprites could be gotten from googlecode, but would require XSS whitelisting */
    48 var masks = [
    47 /*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'];*/
    49 '4gsuif',          'Coonskin3',     'jigglypuff',   'NinjaStraight',       'Ryu',              'sth_Super',
    48 var masks = [];
    50 'AkuAku',          'Cororon',       'judo',         'NinjaTriangle',       'Samurai',          'sth_Tails',
       
    51 'android',         'Cowboy',        'junior',       'OldMan',              'Samus',            'stormcloud',
       
    52 'angel',           'crown',         'Ken',          'OrangeHair',          'Santa',            'stormtrooper',
       
    53 'anzac',           'cyborg',        'KirbyMask',    'orange',              'SauceBoatSilver',  'StrawHatEyes',
       
    54 'apple',           'darthvader',    'kiss_criss',   'Pantsu',              'ShaggyYeti',       'StrawHatFacial',
       
    55 'ash',             'Deer',          'kiss_frehley', 'Pig',                 'sheep',            'StrawHat',
       
    56 'Balrog',          'diglett',       'kiss_simmons', 'pikachu',             'ShortHair_Black',  'Sunglasses',
       
    57 'banana',          'Disguise',      'kiss_stanley', 'PinkHair',            'ShortHair_Brown',  'SunWukong',
       
    58 'Bandit',          'Dragon',        'knight',       'pinksunhat',          'ShortHair_Grey',   'Teacup',
       
    59 'beaver',          'dwarf',         'Kululun',      'pirate_jack_bandana', 'ShortHair_Red',    'Teapot',
       
    60 'beefeater',       'eastertop',     'Ladle',        'pirate_jack',         'ShortHair_Yellow', 'Terminator_Glasses',
       
    61 'Blanka',          'Elvis',         'lambda',       'Plunger',             'Skull',            'test',
       
    62 'BlankaToothless', 'Eva_00b',       'Laminaria',    'policecap',           'Sleepwalker',      'thug',
       
    63 'BlueCap',         'Eva_00y',       'laurel',       'porkey',              'slowpoke',         'Toad',
       
    64 'BlueHair',        'Falcon',        'lemon',        'PrincessDaisy',       'Sniper',           'tophats',
       
    65 'Bob',             'Gasmask',       'link',         'PrincessPeach',       'Sonic',            'ushanka',
       
    66 'BrainSlugMouth',  'Geordi',        'lugia',        'Pumpkin_Hat',         'SparkleSuperFun',  'Vega',
       
    67 'BrainSlug',       'Glasses',       'Luigi',        'PurpleHair',          'spartan',          'venom',
       
    68 'Bub',             'GreenCap',      'Mario',        'quotecap',            'spidey',           'Viking',
       
    69 'Bunny',           'GreenHair',     'MegaHogX',     'Rain',                'squirtle',         'voltorb',
       
    70 'charmander',      'GreyHair',      'mickey_ears',  'Rambo',               'sth_AmyClassic',   'Wario',
       
    71 'chef',            'Guile',         'Moose',        'rasta',               'sth_Amy',          'WhySoSerious',
       
    72 'chikorita',       'HogInTheHat',   'mp3',          'RedCap',              'sth_Eggman',       'WizardHat',
       
    73 'Chunli',          'Honda',         'mudkip',       'RedHair',             'sth_Knux',         'YellowCap',
       
    74 'clown-copper',    'IndianChief',   'Mummy',        'RobinHood',           'sth_Metal',        'YellowHair',
       
    75 'clown-crossed',   'InfernalHorns', 'naruto',       'royalguard',          'sth_Shadow',       'Zombi',
       
    76 'clown',           'Jason',         'NinjaFull',    'RSR',                 'sth_Sonic'];
       
    77 var themes = {
    49 var themes = {
       
    50 "Golf":1,
    78 "Stage":1,
    51 "Stage":1,
    79 "Island":0,
    52 "Island":0,
    80 "Eyes":0,
    53 "Eyes":0,
    81 "Deepspace":0,
    54 "Deepspace":0,
    82 "Jungle":1,
    55 "Jungle":1,
   105 "Castle":1};
    78 "Castle":1};
   106 var girder;
    79 var girder;
   107 var animationInterval;
    80 var animationInterval;
   108 window.onload = function()
    81 window.onload = function()
   109 {
    82 {
       
    83     var xml=new XMLHttpRequest();
       
    84     xml.open("GET", "/hg/share/hedgewars/Data/Graphics/Hats/", false);
       
    85     xml.send(null);
       
    86     /*var resp = xml.responseXML; unfortunately not served as XHTML
       
    87     var a = resp.getElementsByTagName("a");
       
    88     for(var i=0;i<a.length;i++);
       
    89         if (/\.png/.test(a[0].href)) m.push(a[0].replace(/.png/,''));*/
       
    90 
       
    91     var resp = xml.responseText;
       
    92     var r = />([^<]*).png</g;
       
    93     var x;
       
    94     while(x = r.exec(resp)) 
       
    95         if (!/^Team|NoHat/.test(x[1])) // Exclude team coloured ones as repetitive, NoHat one as uninteresting
       
    96             masks.push(x[1]);
       
    97 
   110     var opt = document.createElement("option");
    98     var opt = document.createElement("option");
   111     opt.appendChild(document.createTextNode(""));
    99     opt.appendChild(document.createTextNode(""));
   112     var sel = document.body.appendChild(document.createElement("select"));
   100     var sel = document.body.appendChild(document.createElement("select"));
   113     sel.onchange = switchTheme;
   101     sel.onchange = switchTheme;
   114     for(var theme in themes)
   102     for(var theme in themes)