mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-05-20 22:12:55 -05:00
replayer.css was sort of a badly defined file: it started out as being all the CSS used by the replay viewer, except for the CSS for battles. It then gained utilichart CSS, despite being mostly unrelated. Now, main layout is in main.css in the main domain, and replay layout is in replay.css, and utilichart CSS is in utilchart.css. replayer.css remains a legacy file for the old replay player. Once we transition to the new replay player that uses replay.css, I can get rid of replayer.css completely.
258 lines
9.4 KiB
Plaintext
258 lines
9.4 KiB
Plaintext
<?php
|
|
|
|
// no direct linking to the lobby
|
|
if ($_SERVER['REQUEST_URI'] === '/' || $_SERVER['REQUEST_URI'] === '/lobby') {
|
|
if (!empty($_SERVER['HTTP_REFERER']) && !preg_match('/^https?:\/\/([a-z0-9-]+.)?(pokemonshowdown\.com|appjs)/', $_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_HOST'] === 'play.pokemonshowdown.com') {
|
|
header('HTTP/1.1 303 See Other');
|
|
header('Location: http://pokemonshowdown.com/');
|
|
die();
|
|
}
|
|
}
|
|
|
|
// if (substr($_SERVER['REQUEST_URI'],0,8) === '/battle-') {
|
|
// $id = substr($_SERVER['REQUEST_URI'],8);
|
|
// }
|
|
|
|
// never cache
|
|
header('Cache-Control: no-cache, no-store, must-revalidate'); // HTTP 1.1.
|
|
header('Pragma: no-cache'); // HTTP 1.0.
|
|
header('Expires: 0'); // Proxies.
|
|
|
|
$defaultserver = 'showdown';
|
|
|
|
include '../pokemonshowdown.com/config/servers.inc.php';
|
|
|
|
$server = @$_REQUEST['server'];
|
|
$serverport = 0;
|
|
$serverprotocol = '';
|
|
$serverid = '';
|
|
$usingdefaultserver = false;
|
|
|
|
$psim = false;
|
|
$hostprefix = '';
|
|
if (strlen($_SERVER['HTTP_HOST']) > 8 && substr($_SERVER['HTTP_HOST'], -7) === 'psim.us') {
|
|
$hostprefix = substr($_SERVER['HTTP_HOST'], 0, -8);
|
|
$server = $hostprefix;
|
|
$psim = true;
|
|
}
|
|
|
|
$colonpos = strpos($server, ':');
|
|
$protocolpos = strrpos($server, '|');
|
|
$serverport = intval(@$_REQUEST['serverport']);
|
|
|
|
$localflag = false;
|
|
if ($protocolpos) {
|
|
$serverprotocol = substr($server, $protocolpos+1);
|
|
if (!strlen($serverprotocol)) $localflag = true;
|
|
$server = substr($server, 0, $protocolpos);
|
|
}
|
|
|
|
if ($colonpos) {
|
|
if (!$serverport) $serverport = substr($server, $colonpos+1);
|
|
$server = substr($server, 0, $colonpos);
|
|
}
|
|
|
|
$afd = false;
|
|
if ($psim) {
|
|
$hyphenpos = strrpos($server, '-');
|
|
if ($hyphenpos) {
|
|
if (substr($server, $hyphenpos + 1) === 'afd') {
|
|
$afd = true;
|
|
$server = substr($server, 0, $hyphenpos);
|
|
} else if (ctype_digit(substr($server, $hyphenpos + 1))) {
|
|
$serverport = substr($server, $hyphenpos + 1);
|
|
$server = substr($server, 0, $hyphenpos);
|
|
}
|
|
}
|
|
}
|
|
|
|
$serverdata = array();
|
|
$challengeresponse = false;
|
|
if (@$PokemonServers[$server]) {
|
|
$serverid = $server;
|
|
$serverdata = $PokemonServers[$server];
|
|
if (!$serverport) $serverport = $PokemonServers[$serverid]['port'];
|
|
$serveraltport = @$PokemonServers[$serverid]['altport'];
|
|
if (!$serverprotocol) $serverprotocol = $PokemonServers[$serverid]['protocol'];
|
|
$server = $PokemonServers[$serverid]['server'];
|
|
if ($serverport != $PokemonServers[$serverid]['port']) $serverid .= ':'.$serverport;
|
|
$challengeresponse = !empty($PokemonServers[$serverid]['challengeresponse']);
|
|
}
|
|
if ($localflag) $server = 'localhost';
|
|
|
|
if (!$server) {
|
|
$server = $PokemonServers[$defaultserver]['server'];
|
|
$serverport = $PokemonServers[$defaultserver]['port'];
|
|
$serveraltport = @$PokemonServers[$defaultserver]['altport'];
|
|
$serverprotocol = @$PokemonServers[$defaultserver]['protocol'];
|
|
$challengeresponse = !empty($PokemonServers[$defaultserver]['challengeresponse']);
|
|
$serverid = $defaultserver;
|
|
}
|
|
else if (!$serverid) {
|
|
$serverid = $server.($serverport?':'.$serverport:'');
|
|
}
|
|
if (!$serverport) {
|
|
$serverport = 8000;
|
|
}
|
|
if ($serverprotocol !== 'io' && $serverprotocol !== 'eio') {
|
|
$serverprotocol = 'ws';
|
|
}
|
|
|
|
$serverlibs = array(
|
|
'io' => '/js/socket.io.js',
|
|
'eio' => '/js/engine.io.js',
|
|
'ws' => '/js/sockjs-0.3.min.js'
|
|
);
|
|
$serverlibrary = $serverlibs[$serverprotocol];
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
<title>Showdown!</title>
|
|
<link rel="shortcut icon" href="//play.pokemonshowdown.com/favicon.ico" id="dynamic-favicon" />
|
|
<link rel="stylesheet" href="//play.pokemonshowdown.com/style/sim.css?" />
|
|
<link rel="stylesheet" href="//play.pokemonshowdown.com/style/sim-types.css" />
|
|
<link rel="stylesheet" href="//play.pokemonshowdown.com/style/battle.css?" />
|
|
<link rel="stylesheet" href="//play.pokemonshowdown.com/style/utilichart.css" />
|
|
<link rel="stylesheet" href="//play.pokemonshowdown.com/style/font-awesome.css" />
|
|
<?php if (@$serverdata['customcss']) { ?>
|
|
<link rel="stylesheet" href="//play.pokemonshowdown.com/customcss.php?server=<?php echo $serverid ?>" />
|
|
<?php } ?>
|
|
<meta id="viewport" name="viewport" content="width=640"/>
|
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
|
|
<script>
|
|
var Config = {
|
|
server: '<?php echo $server ?>',
|
|
serverid: '<?php echo $serverid ?>',
|
|
serverport: <?php echo $serverport ?>,
|
|
<?php if (!empty($serveraltport)) echo "serveraltport: $serveraltport,\n"; ?>
|
|
serverprotocol: '<?php echo $serverprotocol ?>',
|
|
<?php if ($psim) { ?>
|
|
crossdomain: {
|
|
prefix: <?php echo json_encode($hostprefix) ?>
|
|
},
|
|
<?php } ?>
|
|
urlPrefix: '<?php if ($serverid && $serverid !== 'showdown' && !$psim) echo '~~',$serverid,'/'; ?>'
|
|
};
|
|
<?php if ($afd) { ?>
|
|
Config.afd = true;
|
|
<?php } ?>
|
|
</script>
|
|
<!--[if lte IE 8]><script>
|
|
Config.oldie = true;
|
|
</script><![endif]-->
|
|
<script type="text/javascript">
|
|
|
|
var _gaq = _gaq || [];
|
|
<?php if (!$psim) { ?>
|
|
_gaq.push(['_setAccount', 'UA-26211653-1'], ['_setDomainName', 'pokemonshowdown.com']);
|
|
<?php } else { ?>
|
|
_gaq.push(['_setAccount', 'UA-26211653-2'], ['_setDomainName', 'psim.us']);
|
|
<?php } ?>
|
|
_gaq.push(['_trackPageview']);
|
|
|
|
(function() {
|
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
})();
|
|
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
<!-- Chrome Frame -->
|
|
<!--[if lte IE 8]>
|
|
<script src="http://ajax.googleapis.com/ajax/libs/chrome-frame/1/CFInstall.min.js"></script>
|
|
<style>
|
|
/*
|
|
CSS rules to use for styling the overlay:
|
|
.chromeFrameOverlayContent
|
|
.chromeFrameOverlayContent iframe
|
|
.chromeFrameOverlayCloseBar
|
|
.chromeFrameOverlayUnderlay
|
|
*/
|
|
</style>
|
|
<script>
|
|
CFInstall.check({mode: "overlay", destination: "http://play.pokemonshowdown.com"});
|
|
</script>
|
|
<![endif]-->
|
|
|
|
<div id="simheader">
|
|
<h1 style="margin-top:2px;margin-right:10em;padding-top:0;"><img src="//play.pokemonshowdown.com/pokemonshowdownbeta.png" alt="Pokemon Showdown! (beta)" /></h1>
|
|
</div>
|
|
<div id="leftbarbg"><div><span></span></div></div>
|
|
<div id="leftbar">
|
|
<div>
|
|
<a id="tabtab-lobby" class="cur" href="#" onclick="return selectTab('lobby');">Lobby</a>
|
|
</div>
|
|
</div>
|
|
<div id="main">
|
|
<div id="loading-message" style="padding:20px">Initializing... <noscript>Surprise, surprise, this requires JavaScript</noscript></div>
|
|
</div>
|
|
<div id="lobbychat" class="lobbychat"></div>
|
|
<div id="userbar">
|
|
<em>Connecting...</em>
|
|
</div>
|
|
<div id="backbutton">
|
|
<div><button onclick="return selectTab('lobby');">« Lobby</button></div>
|
|
</div>
|
|
<div id="overlay" style="display:none"></div>
|
|
<div id="tooltipwrapper"><div class="tooltipinner"></div></div>
|
|
<div id="foehint"></div>
|
|
<script>
|
|
document.getElementById('loading-message').innerHTML += ' DONE<br />Loading libraries...';
|
|
</script>
|
|
<script src="//play.pokemonshowdown.com/js/jquery-1.9.0.min.js"></script>
|
|
<script src="//play.pokemonshowdown.com/js/jquery-cookie.js"></script>
|
|
<script src="//play.pokemonshowdown.com/js/autoresize.jquery.min.js"></script>
|
|
<script src="//play.pokemonshowdown.com/js/jquery.json-2.3.min.js"></script>
|
|
<script src="//play.pokemonshowdown.com/js/soundmanager2-nodebug-jsmin.js"></script>
|
|
<script>
|
|
soundManager.setup({url: '//play.pokemonshowdown.com/swf/'});
|
|
</script>
|
|
<script src="//play.pokemonshowdown.com/js/html-sanitizer-minified.js"></script>
|
|
|
|
<script>
|
|
document.getElementById('loading-message').innerHTML += ' DONE<br />Loading client...';
|
|
document.getElementById('loading-message').innerHTML = 'If the client is taking a long time to load, try refreshing in a few minutes. If it still doesn\'t work, Pokemon Showdown may be down for maintenance. We apologize for the inconvenience.<br /><br />'+document.getElementById('loading-message').innerHTML;
|
|
</script>
|
|
|
|
<script src="//play.pokemonshowdown.com/js/config.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/js/battledata.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/data/pokedex-mini.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/js/battle.js?"></script>
|
|
<!--script src="http://'.$server.':'.$serverport.'/socket.io/socket.io.js"></script-->
|
|
<script src="//play.pokemonshowdown.com<?php echo $serverlibrary; ?>"></script>
|
|
<script src="//play.pokemonshowdown.com/js/teambuilder.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/js/ladder.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/js/sim.js?"></script>
|
|
|
|
<script>
|
|
if (!teams) Config.down = true;
|
|
if (Config.down) overlay('down');
|
|
</script>
|
|
|
|
<script src="//play.pokemonshowdown.com/data/learnsets.js?"></script>
|
|
|
|
<script src="//play.pokemonshowdown.com/data/graphics.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/data/pokedex.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/data/formats-data.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/data/moves.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/data/items.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/data/abilities.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/data/formats.js?"></script>
|
|
<script src="//play.pokemonshowdown.com/data/typechart.js?"></script>
|
|
|
|
<script src="//play.pokemonshowdown.com/js/utilichart.js?"></script>
|
|
|
|
<script src="//play.pokemonshowdown.com/data/aliases.js?" async="async"></script>
|
|
<script>
|
|
updateResize();
|
|
if (init) init();
|
|
</script>
|
|
</body>
|
|
</html>
|