mirror of
https://github.com/ENSL/ensl.org.git
synced 2024-11-15 09:21:25 +00:00
Mute button for gather.
This commit is contained in:
parent
5a7c9f60d0
commit
6560fe18f9
2 changed files with 33 additions and 5 deletions
|
@ -12,7 +12,7 @@
|
|||
|
||||
<p>Gather running, <%= Gather::FULL - @gather.gatherers.length %> more needed.</p>
|
||||
<p>
|
||||
You can download custom maps via the
|
||||
You can download custom maps via the
|
||||
<%= link_to "Steam Workshop", "http://steamcommunity.com/workshop/browse?searchtext=&childpublishedfileid=0§ion=items&appid=4920&browsesort=trend&requiredtags%5B%5D=level" %>.
|
||||
</p>
|
||||
|
||||
|
@ -49,13 +49,13 @@
|
|||
|
||||
<% elsif @gather.status == Gather::STATE_FINISHED and @gather.server %>
|
||||
<p>Gather finished, join the Server and TeamSpeak 3.</p>
|
||||
|
||||
|
||||
<p>
|
||||
<strong>Maps</strong>: <%= namelink @gather.map1.map if @gather.map1 %>, <%= (namelink @gather.map2.map) if @gather.map2 %> <br>
|
||||
<strong>Server</strong>:
|
||||
<strong>Server</strong>:
|
||||
<% if @gather.server %>
|
||||
<%= @gather.server %>
|
||||
(<%= @gather.server.ip %>:<%= @gather.server.port %> ;
|
||||
(<%= @gather.server.ip %>:<%= @gather.server.port %> ;
|
||||
password = <%= if @gather.server.password then @gather.server.password else "<Password not specified>" end %>)
|
||||
<% end %>
|
||||
</p>
|
||||
|
@ -67,6 +67,8 @@
|
|||
<% end %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<%= link_to "Mute", '#', id: "mute", class: 'button tiny' %>
|
||||
<% if cuser and cuser.admin? %>
|
||||
<%= link_to "Admin Page", edit_gather_url, class: 'admin button' %>
|
||||
<% end %>
|
||||
|
|
|
@ -1,11 +1,14 @@
|
|||
<div id="jplayer"></div>
|
||||
<script type="text/javascript">
|
||||
var played = false;
|
||||
var muted = false;
|
||||
var leave_confirm = true;
|
||||
<% if @gatherer and @gatherer.can_destroy? cuser %>
|
||||
var gatherer_id = <%= @gatherer.id %>;
|
||||
var muted = false;
|
||||
<% else %>
|
||||
var gatherer_id = 0;
|
||||
var muted = true;
|
||||
<% end %>
|
||||
|
||||
function updateGathererStatus(status) {
|
||||
|
@ -22,6 +25,7 @@
|
|||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
init_mute();
|
||||
$.PeriodicalUpdater("/gathers/" + <%= @gather.id %> + ".js", {
|
||||
method: "GET",
|
||||
type: "script",
|
||||
|
@ -35,7 +39,7 @@
|
|||
$(this).jPlayer("setMedia", {
|
||||
mp3: "http://www.ensl.org/sounds/gather-1.mp3"
|
||||
}).jPlayer("play");
|
||||
|
||||
|
||||
var click = document.ontouchstart === undefined ? 'click' : 'touchstart';
|
||||
var kickoff = function () {
|
||||
$("#jplayer").jPlayer("play");
|
||||
|
@ -55,9 +59,31 @@
|
|||
else if (response.length > 10) {
|
||||
$("#jplayer").jPlayer("stop");
|
||||
}
|
||||
init_mute();
|
||||
}
|
||||
});
|
||||
|
||||
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;
|
||||
});
|
||||
}
|
||||
$(window).bind('unload', function() {
|
||||
if (gatherer_id > 0 && leave_confirm) {
|
||||
updateGathererStatus('leaving');
|
||||
|
|
Loading…
Reference in a new issue