-
Notifications
You must be signed in to change notification settings - Fork 3
/
pubcomp.html
168 lines (155 loc) · 6.5 KB
/
pubcomp.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>PubComp {SERVERNAME} Status</title
<meta name="generator" content="PubComp" />
<link rel="stylesheet" href="http://{SITEURL}/wp-content/plugins/buddypress/bp-themes/bp-default/style.css" type="text/css" media="screen" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<link rel='index' title='PubComp' href='http://{SITEURL}/' />
<style type="text/css">#header{background-image:url(http://{SITEURL}/wp-content/plugins/buddypress/bp-themes/bp-default/_inc/images/default_header.jpg)}#header h1 a,#desc{color:#fff}</style>
<script type="text/javascript"> jQuery(document).ready( function() { jQuery("a.confirm").click( function() { if ( confirm( 'Are you sure?' ) ) return true; else return false; }); });</script>
<script src="/socket.io/socket.io.js"></script>
</head>
<body class="page page-template page-template-serverstats" id="bp-default">
<div id="header">
<h1 id="logo"><a href="http://{SITEURL}" title="Home">PubComp</a></h1>
<ul id="nav">
<li>
<a href="http://{SITEURL}" title="Home">Home</a>
</li>
<li>
<a href="http://{SITEURL}/activity/" title="Activity">Activity</a>
</li>
<li>
<a href="http://{SITEURL}/members/" title="Members">Members</a>
</li>
<li>
<a href="http://{SITEURL}/groups/" title="Groups">Groups</a>
</li>
<li>
<a href="http://{SITEURL}/forums/" title="Forums">Forums</a>
</li>
</ul><!-- #nav -->
<div id="search-bar">
<div class="padder">
<form action="http://{SERVERURL}/search" method="post" id="search-form">
<input type="text" id="search-terms" name="search-terms" value="" />
<select name="search-which" id="search-which" style="width: auto"><option value="members">Members</option><option value="groups">Groups</option><option value="forums">Forums</option></select>
<input type="submit" name="search-submit" id="search-submit" value="Search" />
</form><!-- #search-form -->
</div><!-- .padder -->
</div><!-- #search-bar -->
</div><!-- #header -->
<div id="container">
<div id="content">
<div class="padder">
<div class="page" id="blog-page">
<h2 class="pagetitle">PubComp {SERVERNAME} Status</h2>
<div class="post">
<div class="entry">
<button id="create" disabled="disabled">Getting TF2 state...</button>
<div id="blurb-updating">The TF2 server is currently checking for updates. It might be a while before it's ready for use.<br/>
<br/>Update status:
<pre id="updatestatus"><div id="updatestatus_inner"></div>
<span id="updatestatus_file"></span> <span id="updatestatus_lag"></span></pre></div>
<div id="blurb-starting">The TF2 server has finished checking for updates and will now start. It will only be a minute or two before the server is ready.</div>
<div id="blurb-almost">The TF2 server is almost ready. This stage in startup is the final plugin initialization. It should be ready in under a minute.</div>
<div id="blurb-online">The TF2 server is ready for a match. There <span id="player-count">are no players</span> on it right now.</div>
<br/><div id="game" style="display: none;">BLU: <span id="bluscore"></span><br/>RED: <span id="redscore"></span></div>
</div>
</div>
</div><!-- .page -->
</div><!-- .padder -->
</div><!-- #content -->
<div id="sidebar">
<div class="padder">
<div id="online"></div><div id="status"></div>
</div><!-- .padder -->
</div><!-- #sidebar -->
</div> <!-- #container -->
<script>
var socket;
$( function(){
$( '[id^="blurb-"]' ).hide();
socket = new io.Socket( null, { port: {SOCKETPORT}, rememberTransport: true } );
socket.connect();
var blurb, status = $( '#status' );
socket.on('message', function( obj ) {
if ( typeof obj != 'object' ) {
return;
}
if ( 'numOnline' in obj ) {
status.text( obj.numOnline + ( obj.numOnline == 1 ? ' user on this page' : ' users on this page' ) );
}
if ( 'tf' in obj ) {
var create = $( '#create' );
switch ( obj.tf ) {
case 'online':
create.text( {WPCOOKIE}.length ? 'Join match' : 'Log in to join this match' ).removeProp( 'disabled' ).unbind( 'click' ).click( function(){
{WPCOOKIE}.length ? socket.send( {action: 'join_match', cookie: {WPCOOKIE}} ) : ( location.href = '{WPLOGIN}' );
} );
break;
default:
create.text( 'TF2 server status: ' + obj.tf ).prop( 'disabled', true ).unbind( 'click' );
break;
}
if ( blurb && blurb.attr( 'id' ) != ( 'blurb-' + obj.tf ) ) {
blurb.slideUp();
}
if ( ( blurb = $( '#blurb-' + obj.tf ) ).length ) {
blurb.slideDown();
}
}
if ( 'joinserver' in obj ) {
location.href = 'steam://connect/' + obj.joinserver;
}
if ( 'state' in obj ) {
var state = obj.state;
if ( 'update_add' in state ) {
state.update = $( '#updatestatus_inner' ).text() + state.update_add;
}
if ( 'update' in state ) {
$( '#updatestatus_inner' ).text( state.update );
}
if ( 'file' in state ) {
if ( state.file ) {
$( '#updatestatus_file' ).text( 'Currently checking file: ' + state.file );
} else {
$( '#updatestatus_file' ).empty();
}
}
if ( 'lag' in state ) {
$( '#updatestatus_lag' ).text( state.lag && state.lag > 5 ? '(' + state.lag + 's)' : '' );
}
var online = 0;
if ( 'players' in state ) {
for ( var i = 0; i < state.players.length; i++ ) {
if ( state.players[i].online )
online++;
}
}
$( '#player-count' ).text( online == 0 ? 'are no players' :
( online == 1 ? 'is one player' : ( 'are ' + online + ' players' ) ) );
if ( online ) {
$( '#game' ).show();
} else {
$( '#game' ).hide();
}
$( '#bluscore' ).text( state.blueScore );
$( '#redscore' ).text( state.redScore );
}
if ( window.console && console.log )
console.log( JSON.stringify( obj ) );
});
socket.on('connect', function(){ status.empty(); });
socket.on('disconnect', function(){ status.text( 'Lost connection.' ) });
socket.on('reconnect', function(){ status.empty() });
socket.on('reconnecting', function( nextRetry ){ status.text( 'Lost connection. Retrying in ' + ~~( nextRetry / 60000 ) + ':' + ( '00' + ~~( nextRetry / 1000 % 60 ) ).substr( -2 ) + '.' ); });
} );
</script>
<div id="footer">
<p>PubComp is proudly powered by <a href="http://wordpress.org">WordPress</a> and <a href="http://buddypress.org">BuddyPress</a></p>
</div><!-- #footer -->
</body>
</html>