2014-04-15 09:59:52 +00:00
|
|
|
<div id="jplayer"></div>
|
2014-03-23 00:22:25 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
var played = false;
|
2015-05-13 21:17:58 +00:00
|
|
|
var muted = false;
|
2014-10-11 14:04:16 +00:00
|
|
|
var leave_confirm = true;
|
2014-10-11 00:50:17 +00:00
|
|
|
<% if @gatherer and @gatherer.can_destroy? cuser %>
|
|
|
|
var gatherer_id = <%= @gatherer.id %>;
|
2015-05-13 21:17:58 +00:00
|
|
|
var muted = false;
|
2014-10-11 00:50:17 +00:00
|
|
|
<% else %>
|
|
|
|
var gatherer_id = 0;
|
2015-05-13 21:17:58 +00:00
|
|
|
var muted = true;
|
2014-10-11 00:50:17 +00:00
|
|
|
<% end %>
|
|
|
|
|
|
|
|
function updateGathererStatus(status) {
|
|
|
|
$.ajax({
|
|
|
|
url: '/gatherers/' + gatherer_id + '/status',
|
|
|
|
type: 'POST',
|
|
|
|
data: {'status': status},
|
|
|
|
async: false,
|
|
|
|
cache: false,
|
|
|
|
success: function() {},
|
|
|
|
complete: function() {},
|
|
|
|
error: function() {}
|
|
|
|
});
|
|
|
|
}
|
2014-03-23 00:22:25 +00:00
|
|
|
|
|
|
|
$(document).ready(function() {
|
2015-05-13 21:17:58 +00:00
|
|
|
init_mute();
|
2014-03-23 00:22:25 +00:00
|
|
|
$.PeriodicalUpdater("/gathers/" + <%= @gather.id %> + ".js", {
|
|
|
|
method: "GET",
|
|
|
|
type: "script",
|
|
|
|
minTimeout: 5000,
|
|
|
|
maxTimeout: 15000,
|
2014-05-16 22:54:41 +00:00
|
|
|
success: function(response, text, request) {
|
2014-12-08 14:35:13 +00:00
|
|
|
if (request.getResponseHeader('Gather') == 'voting') {
|
|
|
|
if (!played) {
|
2018-12-03 20:11:26 +00:00
|
|
|
var startTime = 0;
|
2014-04-15 09:59:52 +00:00
|
|
|
$("#jplayer").jPlayer({
|
2014-03-23 00:22:25 +00:00
|
|
|
ready: function() {
|
|
|
|
$(this).jPlayer("setMedia", {
|
2018-12-03 20:03:07 +00:00
|
|
|
mp3: "https://www.ensl.org/sounds/gather-6.mp3"
|
2018-11-15 19:01:53 +00:00
|
|
|
}).jPlayer("play", startTime);
|
2015-05-13 21:17:58 +00:00
|
|
|
|
2014-03-23 00:22:25 +00:00
|
|
|
var click = document.ontouchstart === undefined ? 'click' : 'touchstart';
|
|
|
|
var kickoff = function () {
|
2018-11-15 19:01:53 +00:00
|
|
|
$("#jplayer").jPlayer("play", startTime);
|
2014-03-23 00:22:25 +00:00
|
|
|
document.documentElement.removeEventListener(click, kickoff, true);
|
|
|
|
};
|
|
|
|
|
|
|
|
document.documentElement.addEventListener(click, kickoff, true);
|
|
|
|
},
|
2018-11-15 19:01:53 +00:00
|
|
|
loop: false,
|
|
|
|
volume: 0.45,
|
2014-03-23 00:22:25 +00:00
|
|
|
swfPath: "/flash"
|
|
|
|
});
|
2014-12-08 14:35:13 +00:00
|
|
|
|
|
|
|
played = true
|
2014-03-23 00:22:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (response.length > 10) {
|
2014-04-15 09:59:52 +00:00
|
|
|
$("#jplayer").jPlayer("stop");
|
2014-03-23 00:22:25 +00:00
|
|
|
}
|
2015-05-13 21:17:58 +00:00
|
|
|
init_mute();
|
2014-03-23 00:22:25 +00:00
|
|
|
}
|
|
|
|
});
|
2014-10-11 00:50:17 +00:00
|
|
|
|
2015-05-13 21:17:58 +00:00
|
|
|
function init_mute() {
|
|
|
|
if(!muted){
|
|
|
|
$("#mute").text("Mute");
|
|
|
|
$("#jplayer").jPlayer("unmute");
|
|
|
|
} else {
|
|
|
|
$("#mute").text("Unmute");
|
|
|
|
$("#jplayer").jPlayer("mute");
|
|
|
|
}
|
|
|
|
$("#mute").off("click");
|
|
|
|
$("#mute").on("click", function() {
|
|
|
|
if(muted){
|
|
|
|
$(this).text("Mute");
|
|
|
|
$("#jplayer").jPlayer("unmute");
|
|
|
|
} else {
|
|
|
|
$(this).text("Unmute");
|
|
|
|
$("#jplayer").jPlayer("mute");
|
|
|
|
}
|
|
|
|
muted = !muted;
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
}
|
2014-10-11 00:50:17 +00:00
|
|
|
$(window).bind('unload', function() {
|
2014-10-11 14:04:16 +00:00
|
|
|
if (gatherer_id > 0 && leave_confirm) {
|
2014-10-11 00:50:17 +00:00
|
|
|
updateGathererStatus('leaving');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-10-11 14:04:16 +00:00
|
|
|
var disable_leave_confirm = function() {
|
|
|
|
leave_confirm = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$('.leave-gather').click(disable_leave_confirm);
|
|
|
|
$('#gather-area a').click(disable_leave_confirm);
|
2014-10-11 13:13:07 +00:00
|
|
|
|
2014-10-11 00:50:17 +00:00
|
|
|
var afk = false;
|
|
|
|
var afk_timeout;
|
|
|
|
var afk_time = 1000 * 60 * 15; // 15 minutes
|
|
|
|
$(window).blur(function() {
|
|
|
|
afk_timeout = setTimeout(function() {
|
|
|
|
if (gatherer_id > 0) {
|
|
|
|
afk = true;
|
|
|
|
updateGathererStatus('away');
|
|
|
|
}
|
|
|
|
}, afk_time);
|
|
|
|
});
|
|
|
|
|
|
|
|
$(window).focus(function() {
|
|
|
|
if (afk) {
|
|
|
|
updateGathererStatus('active');
|
|
|
|
$.get("/gathers/" + <%= @gather.id %> + ".js");
|
|
|
|
}
|
|
|
|
|
|
|
|
clearTimeout(afk_timeout);
|
|
|
|
});
|
2014-03-23 00:22:25 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2014-04-15 09:59:52 +00:00
|
|
|
<div id="gather">
|
|
|
|
<h1 class="fancy">
|
|
|
|
<span>
|
|
|
|
<%= link_to @gather do %>
|
|
|
|
<%= @gather.category.to_s %> Gather
|
2014-10-11 00:50:17 +00:00
|
|
|
<% end %>
|
2014-04-15 09:59:52 +00:00
|
|
|
</span>
|
|
|
|
</h1>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-15 09:59:52 +00:00
|
|
|
<div class="previous">
|
|
|
|
<%= link_to @gather.previous_gather, class: 'button tiny' do %>
|
|
|
|
<%= icon 'chevron-left' %> Previous
|
2014-03-23 00:22:25 +00:00
|
|
|
<% end %>
|
2014-04-15 09:59:52 +00:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="next">
|
|
|
|
<% if @gather.next_gather %>
|
|
|
|
<%= link_to @gather.next_gather, class: 'button tiny' do %>
|
|
|
|
Next <%= icon 'chevron-right' %>
|
2014-03-23 00:22:25 +00:00
|
|
|
<% end %>
|
2014-04-15 09:59:52 +00:00
|
|
|
<% end %>
|
|
|
|
</div>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2015-09-18 12:35:17 +00:00
|
|
|
<h4 class="fancy add-top">
|
2018-04-12 17:30:06 +00:00
|
|
|
NS2 gathers have moved to <%= link_to "gathers.ensl.org", gathers_url, target: "_blank" %>. This page is for the real game.
|
2015-09-18 12:35:17 +00:00
|
|
|
</h4>
|
|
|
|
|
2014-04-05 00:03:13 +00:00
|
|
|
<% if @gather and @gather.status != Gather::STATE_FINISHED %>
|
2014-04-15 09:59:52 +00:00
|
|
|
<div id="gather-info">
|
|
|
|
<div class="info">
|
|
|
|
<h6>Requirements</h6>
|
|
|
|
<ul>
|
|
|
|
<li><a href="https://www.google.com/adsense/support/bin/answer.py?hl=en&answer=12654">JavaScript</a> enabled</li>
|
|
|
|
<li>Read the <%= link_to "Gather Rules", article_url(Article::G_RULES) %></li>
|
|
|
|
<li>Remove yourself if you leave</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-15 09:59:52 +00:00
|
|
|
<div class="info">
|
2014-12-08 14:35:13 +00:00
|
|
|
<h6>Captains</h6>
|
2014-04-15 09:59:52 +00:00
|
|
|
<ul>
|
2014-12-08 14:35:13 +00:00
|
|
|
<li>Vote for the <strong>best</strong> players</li>
|
|
|
|
<li>Captain 1 = 2nd most voted</li>
|
|
|
|
<li>Captain 2 = 1st most voted</li>
|
2014-04-15 09:59:52 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2015-04-19 09:49:06 +00:00
|
|
|
<div class="info">
|
|
|
|
<h6>Gather Info</h6>
|
|
|
|
<ul>
|
2018-04-12 17:30:06 +00:00
|
|
|
<li><%= link_to "Gather topic (all info)", "https://www.ensl.org/topics/1897" %></li>
|
|
|
|
<li><%= link_to "Join the discord", "https://discord.gg/a8dT2cn" %></li>
|
|
|
|
<li><%= link_to "Connect to game server", "steam://connect/51.15.77.137:27015/europe// -noforcemparms" %></li>
|
2015-04-19 09:49:06 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
2014-04-15 09:59:52 +00:00
|
|
|
<div class="info">
|
2018-04-12 17:30:06 +00:00
|
|
|
<h6>Voice Communication</h6>
|
2014-04-15 09:59:52 +00:00
|
|
|
<ul>
|
|
|
|
<li><%= link_to "Teamspeak 3", "http://www.teamspeak.com/?page=downloads" %></li>
|
2018-11-15 19:01:53 +00:00
|
|
|
<li><strong>Click to join:</strong> <a href="ts3server://ensl.org?channel=NS1%20Gathers">ensl.org</a></li>
|
|
|
|
<li><strong>TS password:</strong> europe </li>
|
2014-04-15 09:59:52 +00:00
|
|
|
</ul>
|
|
|
|
</div>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-15 09:59:52 +00:00
|
|
|
<div class="hide">
|
|
|
|
<a id="gather-info-hide" class="button tiny">
|
|
|
|
<%= icon 'times' %>
|
|
|
|
Hide information
|
|
|
|
</a>
|
2014-03-23 00:22:25 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2018-04-12 17:30:06 +00:00
|
|
|
<% end %>
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-04-15 09:59:52 +00:00
|
|
|
<div id="gather-area">
|
2014-03-23 00:22:25 +00:00
|
|
|
<%= render_gather %>
|
|
|
|
</div>
|
|
|
|
|
2014-04-15 09:59:52 +00:00
|
|
|
<%= render partial: 'shoutmsgs/index', locals: { object: @gather } %>
|
2014-03-23 00:22:25 +00:00
|
|
|
</div>
|