Voting on Polls and Muted Words

This commit is contained in:
Daisuke
2020-04-22 20:25:00 -05:00
parent 64f540dce5
commit f1a4636a5a
16 changed files with 195 additions and 60 deletions

View File

@ -65,6 +65,31 @@ $query = http_build_query(array_filter(array(
$('#postform').toggle();
});
$('body').on('click', '.polloption:not(.fixed)', function(e) {
if (typeof $(this).parent().attr('multiple') == 'undefined'){
$('.polloption').removeClass('voted');
}
$(this).toggleClass('voted');
});
$('body').on('click', '.vote', function(e) {
var id = $(this).attr('id');
var c = 0;
var choice = [];
$('#'+id+'.poll .polloption').each(function(a){
if ($(this).hasClass('voted')){
console.log(c);
choice.push(c);
}
c++;
});
var choices = choice.join(',');
console.log(choices);
$.get("action.php?a=true&vote="+id+"&choices="+choices, function(result) {
$('#'+id+'.poll').html(result);
});
});
$('body').on('click', '.searchform', function(e) {
$(this).prev().toggle();
});