Add guest login, tweak button visibility

This commit is contained in:
calzoneman 2013-04-27 12:55:17 -05:00
parent 5e5ff5f414
commit d168c8fff7
3 changed files with 26 additions and 4 deletions

View file

@ -196,6 +196,19 @@ $("#qlockbtn").click(function() {
$("#login").click(showLoginFrame); $("#login").click(showLoginFrame);
function guestLogin() {
uname = $("#guestname").val();
socket.emit("login", {
name: $("#guestname").val()
});
}
$("#guestlogin").click(guestLogin);
$("#guestname").keydown(function(ev) {
if(ev.keyCode == 13) {
guestLogin();
}
});
$("#logout").click(function() { $("#logout").click(function() {
eraseCookie("sync_uname"); eraseCookie("sync_uname");
eraseCookie("sync_session"); eraseCookie("sync_session");

View file

@ -751,7 +751,9 @@ function handleRankChange() {
for(var i = 0; i < users.length; i++) { for(var i = 0; i < users.length; i++) {
addUserDropdown(users[i], users[i].children[1].innerHTML); addUserDropdown(users[i], users[i].children[1].innerHTML);
} }
$("#getplaylist").css("width", "34%");
$("#clearplaylist").css("display", "");
$("#shuffleplaylist").css("display", "");
$("#modnav").show(); $("#modnav").show();
$("#chancontrols").show(); $("#chancontrols").show();
} }
@ -774,6 +776,11 @@ function handleRankChange() {
$(this).find(".btn-danger").remove(); $(this).find(".btn-danger").remove();
}); });
} }
if(RANK < Rank.Moderator) {
$("#getplaylist").css("width", "100%");
$("#clearplaylist").css("display", "none");
$("#shuffleplaylist").css("display", "none");
}
} }
function onWindowFocus() { function onWindowFocus() {

View file

@ -29,6 +29,8 @@
<li><a href="help.html">Help</a></li> <li><a href="help.html">Help</a></li>
</ul> </ul>
<div class="navbar-form pull-right" id="loginform"> <div class="navbar-form pull-right" id="loginform">
<input type="text" id="guestname" placeholder="Name">
<button class="btn" id="guestlogin">Guest Login</button>
<button class="btn" id="login">Login/Register</button> <button class="btn" id="login">Login/Register</button>
</div> </div>
<div class="navbar-form pull-right" id="logoutform" style="display: none;"> <div class="navbar-form pull-right" id="logoutform" style="display: none;">
@ -111,9 +113,9 @@
</div> </div>
<button class="btn btn-danger btn-block" id="qlockbtn" style="display:none;">Unlock Queue</button> <button class="btn btn-danger btn-block" id="qlockbtn" style="display:none;">Unlock Queue</button>
<div class="span12 btn-group" style="margin: 0"> <div class="span12 btn-group" style="margin: 0">
<button class="btn" id="getplaylist" style="width: 34%">Get Playlist URLs</button> <button class="btn" id="getplaylist" style="width: 100%">Get Playlist URLs</button>
<button class="btn" id="clearplaylist" style="width: 33%">Clear Playlist</button> <button class="btn" id="clearplaylist" style="width: 33%; display: none;">Clear Playlist</button>
<button class="btn" id="shuffleplaylist" style="width: 33%">Shuffle Playlist</button> <button class="btn" id="shuffleplaylist" style="width: 33%; display: none;">Shuffle Playlist</button>
</div> </div>
</div> </div>
</div> </div>