Improve poll feedback

This commit is contained in:
calzoneman 2013-09-21 00:25:00 -05:00
parent 4517741455
commit 25d225ec97
3 changed files with 26 additions and 8 deletions

View File

@ -1,3 +1,7 @@
Sat Sep 21 00:23 2013 CDT
* www/assets/js/callbacks.js, www/assets/css/ytsync.css: make it more
obvious which option was voted for
Sat Sep 21 00:08 2013 CDT Sat Sep 21 00:08 2013 CDT
* lib/playlist.js: Make .clean(filter) an instance method * lib/playlist.js: Make .clean(filter) an instance method
* lib/chatcommand.js: Make a few minor changes to unbibium's /clean * lib/chatcommand.js: Make a few minor changes to unbibium's /clean

View File

@ -247,10 +247,23 @@ body {
font-size: 14pt; font-size: 14pt;
} }
.option {
margin-top: 3px;
}
.option button { .option button {
margin-right: 15px; margin-right: 15px;
} }
.option-selected {
font-weight: bold;
}
.option-selected button{
border-width: 3px!important;
margin-right: 10px;
}
.nick-highlight { .nick-highlight {
background-color: #ddffdd; background-color: #ddffdd;
} }

View File

@ -996,13 +996,14 @@ Callbacks = {
$("<h3/>").text(data.title).appendTo(poll); $("<h3/>").text(data.title).appendTo(poll);
for(var i = 0; i < data.options.length; i++) { for(var i = 0; i < data.options.length; i++) {
(function(i) { (function(i) {
var callback = function() { var callback = function () {
socket.emit("vote", { socket.emit("vote", {
option: i option: i
}); });
poll.find(".option button").each(function() { poll.find(".option button").each(function() {
$(this).attr("disabled", "disabled"); $(this).attr("disabled", "disabled");
}); });
$(this).parent().addClass("option-selected");
} }
$("<button/>").addClass("btn").text(data.counts[i]) $("<button/>").addClass("btn").text(data.counts[i])
.prependTo($("<div/>").addClass("option").text(data.options[i]) .prependTo($("<div/>").addClass("option").text(data.options[i])
@ -1019,7 +1020,7 @@ Callbacks = {
var poll = $("#pollwrap .active"); var poll = $("#pollwrap .active");
var i = 0; var i = 0;
poll.find(".option button").each(function() { poll.find(".option button").each(function() {
$(this).text(data.counts[i]); $(this).html(data.counts[i]);
i++; i++;
}); });
}, },